Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Support Open API callbacks #531

Open
twastvedt opened this issue Dec 7, 2023 · 0 comments
Open

Feature Request: Support Open API callbacks #531

twastvedt opened this issue Dec 7, 2023 · 0 comments
Labels
feature Request for a new feature help wanted Extra attention is needed

Comments

@twastvedt
Copy link

We'd like to be able to describe callbacks/webhooks in our API. For example,

paths:
  /subscribe:
    post:
      summary: Subscribe to a webhook
      requestBody:
        …
      callbacks:   # Callback definition
        myEvent:   # Event name
          '{$request.body#/callbackUrl}':   # The callback URL,
                                            # Refers to the passed URL
            post:
              requestBody:   # Contents of the callback message
                required: true
                content:
                  application/json:
                    schema:
                      type: object
                      properties:
                        message:
                          type: string
                          example: Some event happened
                      required:
                        - message
              responses:   # Expected responses to the callback message
                '200':
                  description: Your server returns this code if it accepts the callback

(https://swagger.io/docs/specification/callbacks)

For the above example, Oazapfts generates the /subscribe endpoint, but nothing is generated for the callback part of the spec. Ideally we would get a type for the body of the callback request, something like:

type myEventBody = {
  message: string
}

I'm not sure if there's anything beyond that which would be useful to generate?

@Xiphe Xiphe added help wanted Extra attention is needed feature Request for a new feature labels Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Request for a new feature help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants