Skip to content

Conversation

@JaredCE
Copy link

@JaredCE JaredCE commented Oct 3, 2025

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 $schema property 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.

name: { type: 'string' },
tag: { type: 'string' }
},
type: [null, 'null']

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
type: [null, 'null']

duplicate

Copy link
Author

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'],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
typess: ['object', 'null'],
type: ['object', 'null'],

Copy link
Author

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

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.

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

Successfully merging this pull request may close these issues.

2 participants