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
491 stars 39 forks source link

spectral rules looks not working correctly #369

Closed LasneF closed 7 months ago

LasneF commented 7 months ago

given the spectral rules like this

openapi-v3-schema-properties-names-camel-case: description: Ensuring that schema property names are camel case. message: All schema property names should be camel case. severity: warn given: "$..properties" then: function: casing functionOptions: type: camel

when i launch it against my API is raises such error


Line / Column | Severity | Message                                                                    | Rule                                          | Path
(53:9)        | warning  | Ensuring that schema property names are camel case.: '' is not camel case! | openapi-v3-schema-properties-names-camel-case | $..properties
(53:9)        | warning  | Ensuring that schema property names are camel case.: '' is not camel case! | openapi-v3-schema-properties-names-camel-case | $..properties
(53:9)        | warning  | Ensuring that schema property names are camel case.: '' is not camel case! | openapi-v3-schema-properties-names-camel-case | $..properties
(53:9)        | warning  | Ensuring that schema property names are camel case.: '' is not camel case! | openapi-v3-schema-properties-names-camel-case | $..properties
(53:9)        | warning  | Ensuring that schema property names are camel case.: '' is not camel case! | openapi-v3-schema-properties-names-camel-case | $..properties
(53:9)        | warning  | Ensuring that schema property names are camel case.: '' is not camel case! | openapi-v3-schema-properties-names-camel-case | $..properties
(53:9)        | warning  | Ensuring that schema property names are camel case.: '' is not camel case! | openapi-v3-schema-properties-names-camel-case | $..properties
(53:9)        | warning  | Ensuring that schema property names are camel case.: '' is not camel case! | openapi-v3-schema-properties-names-camel-case | $..properties
(53:9)        | warning  | Ensuring that schema property names are camel case.: '' is not camel case! | openapi-v3-schema-properties-names-camel-case | $..properties
(53:9)        | warning  | Ensuring that schema property names are camel case.: '' is not camel case! | openapi-v3-schema-properties-names-camel-case | $..properties
(53:9)        | warning  | Ensuring that schema property names are camel case.: '' is not camel case! | openapi-v3-schema-properties-names-camel-case | $..properties
(61:15)       | warning  | Ensuring that schema property names are camel case.: '' is not camel case! | openapi-v3-schema-properties-names-camel-case | $..properties
(61:15)       | warning  | Ensuring that schema property names are camel case.: '' is not camel case! | openapi-v3-schema-properties-names-camel-case | $..properties
(61:15)       | warning  | Ensuring that schema property names are camel case.: '' is not camel case! | openapi-v3-schema-properties-names-camel-case | $..properties
(61:15)       | warning  | Ensuring that schema property names are camel case.: '' is not camel case! | openapi-v3-schema-properties-names-camel-case | $..properties
(61:15)       | warning  | Ensuring that schema property names are camel case.: '' is not camel case! | openapi-v3-schema-properties-names-camel-case | $..properties
(61:15)       | warning  | Ensuring that schema property names are camel case.: '' is not camel case! | openapi-v3-schema-properties-names-camel-case | $..properties
(61:15)       | warning  | Ensuring that schema property names are camel case.: '' is not camel case! | openapi-v3-schema-properties-names-camel-case | $..properties
(61:15)       | warning  | Ensuring that schema property names are camel case.: '' is not camel case! | openapi-v3-schema-properties-names-camel-case | $..properties
(61:15)       | warning  | Ensuring that schema property names are camel case.: '' is not camel case! | openapi-v3-schema-properties-names-camel-case | $..properties
(61:15)       | warning  | Ensuring that schema property names are camel case.: '' is not camel case! | openapi-v3-schema-properties-names-camel-case | $..properties
(61:15)       | warning  | Ensuring that schema property names are camel case.: '' is not camel case! | openapi-v3-schema-properties-names-camel-case | $..properties
(93:9)        | warning  | Ensuring that schema property names are camel case.: '' is not camel case! | openapi-v3-schema-properties-names-camel-case | $..properties
(93:9)        | warning  | Ensuring that schema property names are camel case.: '' is not camel case! | openapi-v3-schema-properties-names-camel-case | $..properties

toto.txt

daveshanley commented 7 months ago

Fixed in version v0.5.0

The following ruleset

rules:
  openapi-v3-schema-properties-names-camel-case:
    description: Ensuring that schema property names are camel case
    message: All schema property names should be camel case
    severity: warn
    given: "$..properties"
    then:
      function: casing
      functionOptions:
        type: camel

Combined with the supplied specification in toto.txt Now results in the following output.

Screenshot 2023-11-18 at 9 19 48 AM