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

Unused parameter error message format #537

Closed
philsturgeon opened this issue Sep 10, 2019 · 1 comment · Fixed by #617
Closed

Unused parameter error message format #537

philsturgeon opened this issue Sep 10, 2019 · 1 comment · Fixed by #617
Labels
t/bug Something isn't working

Comments

@philsturgeon
Copy link
Contributor

Describe the bug
I was building a intentionally broken file for a test, and noticed a funny looking error:

Screen Shot 2019-09-10 at 10 30 58

Not sure why the quotes and asterix. Maybe just the quotes but definitely not the asterix.

To Reproduce

Lint this document on stoplight.io/spectral and it'll appear.

openapi: '3.0.0'
info:
  version: 1.0.0
  title: Swagger Petstore
  license:
    name: MIT
paths:
  /pets:
    get:
      summary: Info for a specific pet
      operationId: showPetById
      tags:
        - pets
      parameters:
        - name: petId
          in: path
          required: true
          description: The id of the pet to retrieve
          schema:
            type: string
      responses:
        '200':
          description: Expected response to a valid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Pet'
components:
  schemas:
    Pet:
      required:
        - id
        - name
      properties:
        id:
          type: integer
          format: int64
        name:
          type: string
        tag:
          type: string
@philsturgeon philsturgeon added the t/bug Something isn't working label Sep 10, 2019
@philsturgeon
Copy link
Contributor Author

Weird CLI output too, check this out:

====test====
Request only errors be shown, but no errors exist
====document====
openapi: '3.0.0'
info:
  version: 1.0.0
  title: Swagger Petstore
  license:
    name: MIT
paths:
  /pets/{petId}:
    get:
      summary: Info for a specific pet
      operationId: showPetById
      tags:
        - pets
      parameters:
        - name: petId
          in: path
          required: true
          description: The id of the pet to retrieve
          schema:
            type: string
      responses:
        '200':
          description: Expected response to a valid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Pet'
components:
  schemas:
    Pet:
      required:
        - id
        - name
      properties:
        id:
          type: integer
          format: int64
        name:
          type: string
        tag:
          type: string
====command====
lint {document} --fail-severity=error --display-only-fail-severity-results
====status====
0
====stdout====
OpenAPI 3.x detected
  1:1   warning  api-servers            OpenAPI `servers` must be present and non-empty 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.
  9:9   warning  operation-description  Operation `description` must be present and non-empty string.
 15:11    error  path-params            Parameter "**petId**" is not used in the path "**/pets**".

Unused parameters are not allowed.

To fix, remove this parameter.

✖ 5 problems (1 error, 4 warnings, 0 infos)

We probably don't want those three lines of output.

@philsturgeon philsturgeon added this to the Sept '19 Hardening milestone Sep 10, 2019
@P0lip P0lip closed this as completed in #617 Oct 2, 2019
@P0lip P0lip removed this from the Sept '19 Hardening milestone May 14, 2020
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

Successfully merging a pull request may close this issue.

2 participants