Skip to content

Accept OpenAPI 3.2 documents (and add additionalOperations routing) - #495

Merged
ahx merged 5 commits into
mainfrom
openapi-3-2-support
Aug 12, 2026
Merged

Accept OpenAPI 3.2 documents (and add additionalOperations routing)#495
ahx merged 5 commits into
mainfrom
openapi-3-2-support

Conversation

@ahx

@ahx ahx commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Code-only version of ahx/openapi_first#479 by @aaronlippold, rebased on current main, plus a load-time warning and a CHANGELOG entry that state the support is partial.

Version acceptance

OAS 3.2.0 uses the same JSON Schema dialect as 3.1 (https://spec.openapis.org/oas/3.1/dialect/base), so Builder#detect_meta_schema now accepts 3.2.x and routes it through the existing 3.1 codepath.

Because that codepath is the 3.1 one, features introduced in 3.2 are silently ignored rather than understood. Loading a 3.2 document therefore prints a warning naming the file:

OpenAPI 3.2 is not fully supported. ./openapi.yaml is handled using the OpenAPI 3.1 rules, so features introduced in 3.2 may be ignored.

additionalOperations

OAS 3.2.0 moves non-standard HTTP methods (COPY, LINK, …) into additionalOperations on the Path Item Object. Builder#router iterates that map after the standard REQUEST_METHODS loop; both paths go through a shared register_operation helper extracted from the original loop. Method keys are downcased to match the router's internal convention.

bin/setup

Initializes the spec/data/train-travel-api submodule, without which a fresh clone fails 6 examples.

Notes

  • The README commit from feat: add OpenAPI 3.2 support #479 is not included — the README still says "3.0 or 3.1", which is arguably right while support is partial.
  • Companion: davishmcclurg/json_schemer#230 adds the 3.2.0 structural fields to the document meta-schema so openapi.valid? passes for 3.2.0 documents. Not required for this PR.
  • The register_operation extraction pushed the method past Metrics/MethodLength under the RuboCop config now on main, so response registration is split into register_responses. The now-unneeded rubocop:disable on router is dropped.

Verification

bundle exec rake (RSpec + RuboCop) green on each commit individually; 575 examples, 100% line and branch coverage on the tip.

Related to #469

🤖 Generated with Claude Code

aaronlippold and others added 5 commits August 12, 2026 13:04
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 Builder#detect_meta_schema now
accepts 3.2.x versions and routes them through the existing 3.1
codepath.

Fixes #469

Authored by: Aaron Lippold<lippold@gmail.com>
bin/setup runs bundle install but doesn't initialize the
spec/data/train-travel-api submodule. Developers cloning the repo
and running bin/setup then bundle exec rake see 6 test failures
from missing fixture files. Adding git submodule update --init
--recursive to bin/setup prevents this.

Authored by: Aaron Lippold<lippold@gmail.com>
Process operations defined under path_item.additionalOperations
(OAS 3.2.0 field for non-standard HTTP methods like COPY, LINK).

Extract register_operation helper from the REQUEST_METHODS loop
to share logic between standard methods and additionalOperations.
Method keys from additionalOperations are downcased to match the
router's internal UPPERCASE convention (router.route_at upcases).

3 tests: COPY method routed, GET still works, undefined LINK rejected.
570 examples, 0 failures, 100% line + branch coverage.

Authored by: Aaron Lippold<lippold@gmail.com>
3.2 documents are handled using the OpenAPI 3.1 rules, so features
introduced in 3.2 may be ignored. Say so at load time instead of
letting the document look fully supported.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@ahx ahx mentioned this pull request Aug 12, 2026
5 tasks
@ahx ahx changed the title Add OpenAPI 3.2 support (version acceptance and additionalOperations routing) Accept OpenAPI 3.2 documents (and add additionalOperations routing) Aug 12, 2026
@ahx
ahx marked this pull request as ready for review August 12, 2026 11:25
@ahx
ahx merged commit 25a4953 into main Aug 12, 2026
32 checks passed
@ahx
ahx deleted the openapi-3-2-support branch August 12, 2026 13:30
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