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

redocly lint fails for exclusiveMinimum in an OpenAPI 3.0 spec #2467

Closed
jandppw opened this issue Dec 15, 2023 · 4 comments
Closed

redocly lint fails for exclusiveMinimum in an OpenAPI 3.0 spec #2467

jandppw opened this issue Dec 15, 2023 · 4 comments

Comments

@jandppw
Copy link

jandppw commented Dec 15, 2023

Describe the bug
In an OpenAPI spec that says:

openapi: 3.0.3
info:
  title: funds

redocly lint returns

[67] […]

Example validation errored: exclusiveMinimum value must be ["number"].

 8 |   required: true
 9 |   schema:
10 |     minimum: 0
11 |     exclusiveMinimum: true
 … |     < 5 more lines >
17 |     example: 1
18 | - name: planLabel
19 |   in: path

This is because of a non-backward compatible (!) change from OpenAPI 3.0 to OpenAPI 3.1, as described in ExclusiveMinimum and ExclusiveMaximum.

Expected behavior

The schema should pass when the OpenAPI spec says it is version 3.0, unless redoc no longer supports this version.

Note

This creates issues when using joi-to-json ≥ 4.1.0 (see kenspirit/joi-to-json#49).

@jeremyfiel
Copy link

Can you explain why you think this is a Redocly issue? I don't see Redocly used in the Joi package.

When I try to reproduce it:

this is giving me the correct validation

openapi: 3.0.3
info:
  title: blah
  version: 1.0.0
servers:
  - url: www.redocly.com
paths:
  /v1/thing:
    get:
      summary: a summary
      description: a description
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema: 
                type: number
                minimum: 0
                exclusiveMinimum: true

This throws for

Expected type `boolean` but got `integer`.
openapi: 3.0.3
info:
  title: blah
  version: 1.0.0
servers:
  - url: www.redocly.com
paths:
  /v1/thing:
    get:
      summary: a summary
      description: a description
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema: 
                type: number
                exclusiveMinimum: 0
redocly 1.5.0

@jandppw
Copy link
Author

jandppw commented Dec 18, 2023

Thank you for the apt response.

(The issue I tried to report has nothing to do with Joi, or any other library. That was just a side note and cross-reference.)

You're tests are undoubtedly correct, and seem to negate my report.

I reported what I encountered, and this shows that I probably missed the boat. I'll try to find the time to dig a little deeper, and report back.

@jeremyfiel
Copy link

Try updating your redocly package.

npm install --global @redocly/cli@latest

Happy to help if you still encounter the same issue.

@lornajane
Copy link
Contributor

It doesn't look like there's anything more for us to do here, so I'll close the issue for now - but do let us know if you need anything else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants