-
Notifications
You must be signed in to change notification settings - Fork 61
Support draft 04 schemas #708
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
| name: { type: 'string' }, | ||
| tag: { type: 'string' } | ||
| }, | ||
| type: [null, 'null'] |
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.
| type: [null, 'null'] |
duplicate
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.
You're right, but i think this is fine as part of the test as i noted above
| type: 'array', | ||
| maxItems: 100, | ||
| items: { | ||
| typess: ['object', 'null'], |
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.
| typess: ['object', 'null'], | |
| type: ['object', 'null'], |
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.
@jeremyfiel the point of this test is to skip and output a log for schemas that are invalid, so typess is valid for this test
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.
The problem is JSON Schema expects implementations ignores unknown keywords, the validator should not fail when it encounters the keyword.
Ajv dropped support for Draft-04 schemas, but they're still widely used.
You can use the https://github.com/ajv-validator/ajv-draft-04 package to validate v4 schemas, however you have to use that one specifically for v4 schemas. So I have split out the test for validating schemas into whether it has a
$schemaproperty of "http://json-schema.org/draft-04/schema#" and using the correct Ajv for whichever schema.$schema is a valid property of OpenAPI 3.1.X schemas.