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

Misleading error message when response description is missing #975

Closed
bburtin opened this issue Feb 19, 2020 · 2 comments
Closed

Misleading error message when response description is missing #975

bburtin opened this issue Feb 19, 2020 · 2 comments
Labels
t/bug Something isn't working

Comments

@bburtin
Copy link

bburtin commented Feb 19, 2020

Describe the bug
When I omit the description field from a response, the error I get is "200 property should have required property $ref". It would be better if spectral told the user that the description field is missing.

To Reproduce

Remove the description field from a response and run spectral lint

$ npx spectral lint test.yaml
OpenAPI 3.x detected

.../test.yaml
  1:1   warning  oas3-api-servers       OpenAPI `servers` must be present and non-empty array.
  1:1   warning  openapi-tags           OpenAPI object should have non-empty `tags` array.
  2:6   warning  info-contact           Info object should contain `contact` object.
  2:6   warning  info-description       OpenAPI object info `description` must be present and non-empty string.
  8:9   warning  operation-description  Operation `description` must be present and non-empty string.
  12:9  warning  operation-tag-defined  Operation tags should be defined in global tags.
 14:15    error  oas3-schema            `200` property should have required property `$ref`

Expected behavior
spectral should tell me that the description field is missing

Environment (remove any that are not applicable):

Additional context

$ cat test.yaml   
openapi: "3.0.0"
info:
  version: 1.0.0
  title: REST API

paths:
  /test:
    get:
      summary: List
      operationId: list
      tags:
      - Greenhouse
      responses:
        '200':
          content:
            application/json:
              schema:
                type: object
@bburtin bburtin added the t/bug Something isn't working label Feb 19, 2020
@mloberg
Copy link

mloberg commented Feb 27, 2020

This is probably related to #403

@philsturgeon
Copy link
Contributor

Yep sorry about this. It's a duplicate of #403 so let's chat over there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants