Open gtsystem opened 3 months ago
this is happening because the rule is written with OAS 3.1.0 types import. Either this rule should be modified to only work for 3.1.x descriptions with examples
keyword, or it should be modified to import the correct Schema
node type for the version being processed.
@jeremyfiel not exactly. The issue comes from AJV validating the schema. However, from the context of the schema it's not obvious it's an older draft.
@gtsystem just to point out, there's not much value in using exclusiveMinimum for integers. The issue is still there for numbers though.
When I looked, the impression I have is It's validating against the 3.1 type keyword
Ajv doesn't output the error message in the format seen here. That's from the redocly.ts type definition
I see that this changed between OpenAPI 3.0 (exclusiveMinimum and exclusiveMaximum are booleans) and OpenAPI 3.1 (they are numbers). I can only recommend that you turn off this rule for now.
Alternatively, those particular errors could be suppressed by generating the ignore file: https://redocly.com/docs/cli/commands/lint#generate-ignore-file
Describe the bug
The linter is returning the error
Example validation errored: exclusiveMinimum value must be ["number"]
, however in openapi 3.0.x exclusiveMinimum must be of type boolean, not number.To Reproduce Steps to reproduce the behavior:
And the lint configuration:
Run this command
npx @redocly/cli lint openapi-example.yml --config openapi-example.conf.yml --format=stylish
See error
Expected behavior
The validation pass, because in openapi 3.0.x
exclusiveMinimum
MUST be of type boolean and is defined correctly. This is different in openapi 3.1.0, but the specification provided is for 3.0.2.Redocly Version(s)
1.17.1
Node.js
Version(s)22.2.0
Additional context
Same issue is present using
no-invalid-parameter-examples
rule. See also changes between 3.0.x and 3.1.0: https://www.openapis.org/blog/2021/02/16/migrating-from-openapi-3-0-to-3-1-0