redocly-cli icon indicating copy to clipboard operation
redocly-cli copied to clipboard

Empty Schema Object in content response not detected

Open roukmoute opened this issue 3 years ago • 0 comments

It resumes the ticket: https://github.com/Redocly/redoc/issues/2046

Describe the bug Here it is an example:

post:
  responses:
    '422':
      description: Unprocessable Entity.
      content:
        'application/json':
          schema:

Expected behavior It should return an error.

Swagger proposes should be object and stoplight studio proposes "schema" property type must be object.

Additional context

The correct empty fix for that should be:

post:
  responses:
    '422':
      description: Unprocessable Entity.
      content:
        'application/json': {}

It comes from: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operation-object-example


Ok visibly it is already implemented but I think there is some "miss".

With that example:

post:
  operationId: foobar
  tags:
    - Foo
  summary: Create a foo bar.
  description: Create a foo bar.
  responses:
    '201':
      description: Foo bar successful.
      content:
        'application/json': {}
    '403':
      description: Access Denied.
      content:
        'application/json':
          schema:
    '404':
      description: Not found
      content:
        'application/json':
          schema:

I've got only one error:

doc/api/foo/bar.yaml:
  16:11  error    spec  Expected type `Schema` (object) but got `null`

roukmoute avatar Jun 08 '22 16:06 roukmoute