-
Notifications
You must be signed in to change notification settings - Fork 5
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
Feat: Upgrade AJV from 6 to 8 #31
Conversation
@@ -0,0 +1,20 @@ | |||
diff --git a/node_modules/ajv/dist/compile/validate/dataType.js b/node_modules/ajv/dist/compile/validate/dataType.js |
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.
While waiting for ajv-validator/ajv#2297, we patch this locally
@@ -145,35 +145,6 @@ describe('openapi3/parser', () => { | |||
}]); | |||
}); | |||
|
|||
it('should support the nullable schema keyword in an object property without type', async () => { |
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.
exclusiveMaximum?: number; | ||
exclusiveMinimum?: number; |
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.
OpenAPI defines these as booleans, as did AJV@6.
But since https://json-schema.org/draft-06/json-schema-release-notes.html, it has been converted to a number. AJV followed suite.
const minimumInt64AllowedMinusOne = '-9223372036854775809'; | ||
const maximumInt64Allowed = '9223372036854775807'; | ||
const maximumInt64AllowedPlusOne = '9223372036854775808'; |
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.
See ajv-validator/ajv-formats#22 (comment)
TLDR: JSON only supports doubles, and JS (without resorting to BigInt) too; pretending otherwise is pointless.
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.
🤷🏽♀️ I trust you Voon!
nullable
requires use oftype
, see https://github.com/ajv-validator/ajv/blob/490eb8c0eba8392d071fef005e16d330f259d0ba/lib/compile/validate/dataType.ts#L26C66-L26C66