Skip to content

feat: add OpenAPI 3.2 support#230

Open
aaronlippold wants to merge 4 commits into
davishmcclurg:mainfrom
aaronlippold:feat/openapi-3.2-support
Open

feat: add OpenAPI 3.2 support#230
aaronlippold wants to merge 4 commits into
davishmcclurg:mainfrom
aaronlippold:feat/openapi-3.2-support

Conversation

@aaronlippold

@aaronlippold aaronlippold commented May 26, 2026

Copy link
Copy Markdown

Summary

Full OpenAPI 3.2.0 support — both schema validation and document structure validation.

Schema validation

OAS 3.2.0 uses the same JSON Schema dialect as 3.1 (https://spec.openapis.org/oas/3.1/dialect/base). The version regex in OpenAPI#initialize now accepts 3.2.x versions and routes them through the existing 3.1 codepath. Schema validation works identically.

Document structure validation (openapi.valid?)

The document meta-schema in document.rb has been updated with all structural fields added in OAS 3.2.0:

Object New Fields
OpenAPI Object $self (uri-reference)
Server Object name (string)
Path Item Object query (operation), additionalOperations (map of operations)
Components Object mediaTypes (map of media type or reference)
Example Object dataValue (any), serializedValue (string)
Parameter Object querystring added to in enum

New media-type-or-reference $defs entry added for Components.mediaTypes. The Components patternProperties regex updated to include mediaTypes.

Changes verified against the published specification

All new fields verified against the published spec at spec.openapis.org/oas/v3.2.0.html (the HTML is the source of truth per the spec's own statement). The GitHub release notes describe the full 3.2 line roadmap — some features listed there (e.g., discriminator.defaultMapping, multipart itemSchema) are not in the 3.2.0 publication.

Test plan

  • 208 tests pass (0 failures, 100% line + branch coverage)
  • Boundary tests: 3.2.1 accepted, 3.3.0 rejected
  • One test per new 3.2 field verifying openapi.valid? passes
  • Existing 3.0/3.1 document validation unaffected (no regressions)

Fixes #228

OpenAPI 3.2.0 uses the same JSON Schema dialect as 3.1 — no breaking
changes, only additive features (structured tags, streaming, OAuth
device flow). The version regex in OpenAPI#initialize now accepts
3.2.x versions and routes them through the existing 3.1 codepath.

Fixes davishmcclurg#228

Authored by: Aaron Lippold<lippold@gmail.com>
Copilot AI review requested due to automatic review settings May 26, 2026 13:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR adds OpenAPI 3.2 support by treating it as compatible with the existing OpenAPI 3.1 JSON Schema dialect handling, and updates documentation accordingly.

Changes:

  • Accept OpenAPI 3.2.x version strings in the OpenAPI loader.
  • Add a Minitest case confirming basic schema validation works for an OpenAPI 3.2 document.
  • Update README and CHANGELOG to advertise OpenAPI 3.2 support.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
test/open_api_test.rb Adds coverage ensuring an OpenAPI 3.2 document can be loaded and validated.
lib/json_schemer/openapi.rb Expands version detection to route OpenAPI 3.2 through the existing 3.1 codepath.
README.md Documents OpenAPI 3.2 as supported.
CHANGELOG.md Adds an Unreleased entry noting the new OpenAPI 3.2 feature.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 7 to 12
version = document['openapi']
case version
when /\A3\.1\.\d+\z/
when /\A3\.[12]\.\d+\z/
@document_schema = JSONSchemer.openapi31_document
meta_schema = document.fetch('jsonSchemaDialect') { OpenAPI31::BASE_URI.to_s }
when /\A3\.0\.\d+\z/
Add explicit note in the OpenAPI section explaining that 3.0, 3.1,
and 3.2 are all supported, and that 3.2 shares the 3.1 dialect.

Authored by: Aaron Lippold<lippold@gmail.com>
The openapi.rb regex fix allows 3.2 documents to be parsed, but the
document meta schema in openapi31/document.rb still had a pattern
constraint of ^3\.1\.\d+ which caused document.valid? to return false
for 3.2.0 documents. Updated to ^3\.[12]\.\d+ so both the parser
and the meta schema accept 3.2.

Added assertion to existing test: openapi.valid? must be true.

Authored by: Aaron Lippold<lippold@gmail.com>
Update the document meta-schema (document.rb) with all structural
fields added in OpenAPI 3.2.0:

- OpenAPI Object: $self (uri-reference)
- Server Object: name (string)
- Path Item Object: query (operation) + additionalOperations (map)
- Components Object: mediaTypes (map) + patternProperties regex
- Example Object: dataValue (any) + serializedValue (string)
- Parameter Object in: add querystring enum value
- New media-type-or-reference $defs entry for Components.mediaTypes

Add 8 tests: boundary versions (3.2.1 accepted, 3.3.0 rejected),
and one per new field verifying document validation passes.

208 tests, 54472 assertions, 0 failures. 100% line + branch coverage.

Authored by: Aaron Lippold<lippold@gmail.com>
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.

Add support for OpenAPI 3.2.0

2 participants