Skip to content

Conversation

@AlbinaBlazhko17
Copy link
Contributor

@AlbinaBlazhko17 AlbinaBlazhko17 commented Oct 23, 2025

What/Why/How?

The ajv validator, which we are using to validate JSON Schemas didn't supports exclusiveMininimum and exclusiveMaximum properties as boolean type. That's why i need to use old draft-04 version to have a proper validation for these properties. Also, this old draft-04 version supports only old refs with uri, that's why we need to create own fork and publish own package to npm called @redocly/ajv-draft-04.

Reference

Resolves #1610

Testing

Ran tests new and created.

Screenshots (optional)

Check yourself

  • Code changed? - Tested with Redoc/Realm/Reunite (internal)
  • All new/updated code is covered by tests
  • New package installed? - Tested in different environments (browser/node)
  • Documentation update considered

Security

  • The security impact of the change has been considered
  • Code follows company security practices and guidelines

@AlbinaBlazhko17 AlbinaBlazhko17 requested review from a team as code owners October 23, 2025 15:33
@changeset-bot
Copy link

changeset-bot bot commented Oct 23, 2025

🦋 Changeset detected

Latest commit: 7dfdffa

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@redocly/openapi-core Patch
@redocly/cli Patch
@redocly/respect-core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Oct 23, 2025

Command Mean [s] Min [s] Max [s] Relative
redocly lint packages/core/src/benchmark/benches/rebilly.yaml 1.457 ± 0.022 1.431 1.509 1.00 ± 0.02
redocly-next lint packages/core/src/benchmark/benches/rebilly.yaml 1.451 ± 0.028 1.411 1.512 1.00

package.json Outdated
]
},
"dependencies": {
"ajv-formats": "^3.0.1"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we need it in the root dependencies?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the observation, i removed it, but i think, we need to upgrade ajv-formats package to 3.0.1 in core, because old version causes errors.

): { valid: boolean; errors: (ErrorObject & { suggest?: string[] })[] } {
const validate = getAjvValidator(schema, schemaLoc, resolve, allowAdditionalProperties);
const validate =
specVersion === 'oas3_0' || specVersion === 'oas2'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Coud you add a comment with the link to a document which clarifies the JSON Schema drafts usage for these OAS versions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Draft-04 handles only validation of exclusiveMinimum and exclusiveMaximum for boolean, and all other validations it handles using types/functions/library/vocabulary from basic AJV.

@tatomyr
Copy link
Collaborator

tatomyr commented Oct 24, 2025

Could you check if we need to adjust types in the no-invalid-schema-examples rule itself? (See this comment.)

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.

Lint rules for examples require exclusiveMinimum to be number in openapi 3.0.x

4 participants