Swagger-ui: Editor validation does not pickup issue with callback structure, leading to rendering error in UI panel for OAS3 spec

Created on 26 Jan 2018  路  6Comments  路  Source: swagger-api/swagger-ui

Steps

  1. Go to http://editor.swagger.io/
  2. Paste in example spec:
openapi: 3.0.0
info:
  version: "1.0.0-oas3"
  title: example
paths:
  /api/callbacks:
    post:
      responses:
        '200':
          description: OK
      callbacks:
        callback:
          '/callback':
            post:
              requestBody:
                $ref: '#/components/schemas/callbackRequest'
              responses:
                '200':
                  description: OK
components:
  schemas:
    callbackRequest:
      type: object
      properties:
        property1:
          type: integer
          example: 10000
  1. Expand POST operation
  2. Click Callbacks
  3. Click on /callback POST operation

Expected
callback renders in UI panel

Actual
Console error TypeError: C.get(...) is undefined
If the line:

              requestBody:
                $ref: '#/components/schemas/callbackRequest'

is commented out then the callback is rendered without error
callback rendering error

P1 lock-bot 3.x bug

All 6 comments

The issue can be resolved by changing the callback operation to:

            post:
              requestBody:
                content:            # <-------
                  application/json: # <-------
                    schema:         # <-------
                      $ref: '#/components/schemas/callbackRequest'

However, it can reasonably be expected that Editor validation should pick up on this.

@shockey ping!

This seems to have regressed
image

Aplogies. Was using an invalid definition.
Worth noting, for lack of validation errors. But otherwise this issue is resolved...
Tested with

openapi: 3.0.0
info:
  version: "1.0.0-oas3"
  title: example
paths:
  /api/callbacks:
    post:
      responses:
        '200':
          description: OK
      callbacks:
        callback:
          '/callback':
            post:
              requestBody:
                content:            # <-------
                  application/json: # <-------
                    schema:         # <-------
                      $ref: '#/components/schemas/callbackRequest'
              responses:
                '200':
                  description: OK
components:
  schemas:
    callbackRequest:
      type: object
      properties:
        property1:
          type: integer
          example: 10000

don't scare me like that, @ponelat 馃槃

Locking due to inactivity.

This is done to avoid resurrecting old issues and bumping long threads with new, possibly unrelated content.

If you think you're experiencing something similar to what you've found here: please open a new issue, follow the template, and reference this issue in your report.

Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SzymonKlimuk picture SzymonKlimuk  路  32Comments

peter004 picture peter004  路  49Comments

grosch picture grosch  路  75Comments

chanurahemal picture chanurahemal  路  87Comments

replaysMike picture replaysMike  路  120Comments