-
Notifications
You must be signed in to change notification settings - Fork 7
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