Skip to content

Request Body in Callbacks Produces Error #7465

@jonathon-boldcommerce

Description

@jonathon-boldcommerce

Q&A (please complete the following information)

  • OS: macOs
  • Browser: chrome
  • Version: 92.0.4515.131 (Official Build) (x86_64)
  • Method of installation: online
  • Swagger-UI version: 3.52.0
  • Swagger/OpenAPI version: OpenAPI 3.0.0

Content & configuration

Example Swagger/OpenAPI definition:

openapi: 3.0.0
info:
  version: 1.0.0
  title: test
  description: example with callback
paths:
  /subscribe:
    post:
      summary: Subscribe to a webhook
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                callbackUrl:
                  type: string
                  format: uri
                  example: https://myserver.com/send/callback/here
              required:
                - callbackUrl
      callbacks:
        myEvent:
          '{$request.body#/callbackUrl}':
            post:
              requestBody:
                required: true
                content:
                  application/json:
                    schema:
                      type: object
                      properties:
                        message:
                          type: string
                          example: Some event happened
                      required:
                        - message
              responses:
                '200':
                  description: Your server returns this code if it accepts the callback
      responses:
        '201':
          description: Webhook created

Describe the bug you're encountering

There are no visual problems with rendering this yaml in Swagger UI, but the error that appears in the console says "swagger-ui-es-bundle.js:2 TypeError: Cannot read property 'getIn' of undefined" and is likely causing problems in plugin themes such as swagger-ui-kong-theme.

To reproduce...

Steps to reproduce the behavior:

  1. https://editor.swagger.io/ in chrome
  2. Open the developer console
  3. Paste the yaml file into the editor
  4. Click the /subscribe request
  5. Click the Callbacks tab
  6. Click "{$request.body#/callbackUrl}"
  7. Notice "TypeError: Cannot read property 'getIn' of undefined" in the console

Expected behavior

There should not be an error in the console and this should render properly using other plugins.

Screenshots

Screen Shot 2021-08-17 at 9 12 50 AM

Additional context or thoughts

Possibly related to this open issue: #5536

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions