-
Notifications
You must be signed in to change notification settings - Fork 192
fix: error with invalid type when using exclusiveMininimum and exclusiveMaximum in OpenApi 3.0 #2384
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
base: main
Are you sure you want to change the base?
Conversation
…iveMaximum in oas3
🦋 Changeset detectedLatest commit: 7dfdffa The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
package.json
Outdated
| ] | ||
| }, | ||
| "dependencies": { | ||
| "ajv-formats": "^3.0.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need it in the root dependencies?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the observation, i removed it, but i think, we need to upgrade ajv-formats package to 3.0.1 in core, because old version causes errors.
| ): { valid: boolean; errors: (ErrorObject & { suggest?: string[] })[] } { | ||
| const validate = getAjvValidator(schema, schemaLoc, resolve, allowAdditionalProperties); | ||
| const validate = | ||
| specVersion === 'oas3_0' || specVersion === 'oas2' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coud you add a comment with the link to a document which clarifies the JSON Schema drafts usage for these OAS versions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Draft-04 handles only validation of exclusiveMinimum and exclusiveMaximum for boolean, and all other validations it handles using types/functions/library/vocabulary from basic AJV.
|
Could you check if we need to adjust types in the |
What/Why/How?
The ajv validator, which we are using to validate JSON Schemas didn't supports
exclusiveMininimumandexclusiveMaximumproperties as boolean type. That's why i need to use olddraft-04version to have a proper validation for these properties. Also, this olddraft-04version supports only old refs with uri, that's why we need to create own fork and publish own package to npm called@redocly/ajv-draft-04.Reference
Resolves #1610
Testing
Ran tests new and created.
Screenshots (optional)
Check yourself
Security