Skip to content

Support draft 04 schemas#708

Open
JaredCE wants to merge 16 commits into
apideck-libraries:mainfrom
JaredCE:support-draft-04-schemas
Open

Support draft 04 schemas#708
JaredCE wants to merge 16 commits into
apideck-libraries:mainfrom
JaredCE:support-draft-04-schemas

Conversation

@JaredCE

@JaredCE JaredCE commented Oct 3, 2025

Copy link
Copy Markdown

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

Copy link
Copy Markdown

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

Copy link
Copy Markdown

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
Copy Markdown
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

Copy link
Copy Markdown

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.

@JaredCE

JaredCE commented Dec 12, 2025

Copy link
Copy Markdown
Author

@thim81 all tests should be passing now

@thim81

thim81 commented May 23, 2026

Copy link
Copy Markdown
Collaborator

hi @JaredCE

Would it be possible to update the PR with the latest changes, afterwards we can do a final review.

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.

3 participants