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

exclusiveMaximum / exclusiveMinimum rabbit hole #49

Open
jandppw opened this issue Dec 15, 2023 · 2 comments
Open

exclusiveMaximum / exclusiveMinimum rabbit hole #49

jandppw opened this issue Dec 15, 2023 · 2 comments

Comments

@jandppw
Copy link
Contributor

jandppw commented Dec 15, 2023

The addition of exclusiveMaximum / exclusiveMinimum to negative / positive number type schemata in v4.1.0 opens up a rabbit hole.

When using joi-to-json to generate OpenAPI models, the result conflicts with current @redocly/cli schema validation, e.g.,

[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.

According to the README of joi-to-json, joi-to-json targets “open-api - Stands for OpenAPI 3.0 Schema […]’, so this is not a bug in joi-to-json, but rather in redocly lint (see Redocly/redoc#2467), but the issue might be worth some consideration.

See, e.g., astm-utm/Protocol#65 for the rabbit hole.

@kenspirit
Copy link
Owner

@jandppw Thanks for the reminder. I was not aware of the 3.1 incompatible change before. I have added a separate format support for OpenAPI 3.1 spec in case anyone needs it.

@jandppw
Copy link
Contributor Author

jandppw commented Dec 18, 2023

Damn, that’s fast! 🤩

I will probably not be able to use the new version before the start of next year, but I’m sure it will solve the issue.

Thank you very much!

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

No branches or pull requests

2 participants