daveshanley / vacuum

vacuum is the worlds fastest OpenAPI 3, OpenAPI 2 / Swagger linter and quality analysis tool. Built in go, it tears through API specs faster than you can think. vacuum is compatible with Spectral rulesets and generates compatible reports.
https://quobix.com/vacuum
MIT License
490 stars 39 forks source link

lint --fail-severity parameters missing in documentation #377

Closed mazumba-nx closed 6 months ago

mazumba-nx commented 7 months ago

I am using the docker container dshanley/vacuum:v0.5.1 in a github workflow to check for OpenAPI errors. The command is vacuum lint apidoc.yaml --no-style --fail-severity warning and should return Error 1 when warnings or errors are thrown.

When using the lint command with a file having errors and warnings, the command only exits with Error 1 when either

When using --fail-severity warning, the command displays the errors and warnings but still returns successfully. Here is an example yaml with an error and a couple warnings.

openapi: 3.0.0
info:
  title: 'An Example API'
  description: 'Provide an example for an issue'
  version: 1.0.0
servers:
  -
    url: /api
paths:
  '/api/foo/{id}/bar':
    get:
      tags:
        - Foo
      description: 'Lists orders'
      parameters:
        -
          name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: 'The list of Bars'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Bar'
components:
  schemas:
    Bar:
      properties:
        id:
          type: string
      type: object

I think there is a warning key missing somewhere in the code.

Hope this helps! Thank you!

mazumba-nx commented 7 months ago

After thinking "maybe I can resolve this and create a PR" I found, that the correct parameter is warn and not warning. So no Bug here!

This is not clear from the documentation though. https://quobix.com/vacuum/commands/lint/

Could you include the three possibilities error, warn and info to the list?

ajoga commented 7 months ago

+1 :) this echoes https://github.com/daveshanley/vacuum/issues/367#issuecomment-1816071341

daveshanley commented 6 months ago

A new version command is available in v0.6.0

https://quobix.com/vacuum/commands/version/

Also the docs for the --fail-severity flag has been properly documented.

https://quobix.com/vacuum/commands/lint/#fail-severity