Skip to content

[TT-16410] Validation fixes for OAS 3.1 from community#9

Merged
pvormste merged 2 commits intomasterfrom
TT-16410/validation-fixes-for-3.1
Jan 21, 2026
Merged

[TT-16410] Validation fixes for OAS 3.1 from community#9
pvormste merged 2 commits intomasterfrom
TT-16410/validation-fixes-for-3.1

Conversation

@pvormste
Copy link

@pvormste pvormste commented Jan 21, 2026

Based on this community PR: chanceattoast#1

This pull request adds support for JSON Schema 2020-12 compliant validation when working with OpenAPI 3.1 documents. The changes ensure that validation logic and schema handling are updated to accommodate features and requirements specific to JSON Schema 2020-12, and the new validation mode is automatically enabled for OpenAPI 3.1 documents.

OpenAPI 3.1 / JSON Schema 2020-12 Support:

  • Introduced the EnableJSONSchema2020Validation option in the validation options, allowing the validator to perform JSON Schema 2020-12 compliant validation for OpenAPI 3.1 documents (openapi3/validation_options.go, .github/docs/openapi3.txt). [1] [2]
  • Updated the CLI (cmd/validate/main.go) to detect OpenAPI 3.1 documents and automatically enable JSON Schema 2020-12 validation when appropriate.

Schema Validation Logic:

  • Modified schema validation to support the 'null' type only when JSON Schema 2020-12 validation is enabled, and to pass the relevant option to default value and example validation (openapi3/schema.go, openapi3/example_validation.go). [1] [2] [3]
  • Adjusted handling of extra sibling fields in schema references: such fields are only allowed under JSON Schema 2020-12 validation, enforcing stricter validation otherwise (openapi3/refs.go, openapi3/refs.tmpl). [1] [2]

Other:

  • Added a new field jsonSchema2020ValidationEnabled to ValidationOptions to track if the new validation mode is active (openapi3/validation_options.go).
  • Minor: Updated the code generation comment in refs.tmpl for clarity.

@pvormste pvormste merged commit cca3537 into master Jan 21, 2026
2 checks passed
@pvormste pvormste deleted the TT-16410/validation-fixes-for-3.1 branch January 21, 2026 11:33
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