Accept OpenAPI 3.2 documents (and add additionalOperations routing) - #495
Merged
Conversation
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
marked this pull request as ready for review
August 12, 2026 11:25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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), soBuilder#detect_meta_schemanow accepts3.2.xand 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:
additionalOperationsOAS 3.2.0 moves non-standard HTTP methods (
COPY,LINK, …) intoadditionalOperationson the Path Item Object.Builder#routeriterates that map after the standardREQUEST_METHODSloop; both paths go through a sharedregister_operationhelper extracted from the original loop. Method keys are downcased to match the router's internal convention.bin/setupInitializes the
spec/data/train-travel-apisubmodule, without which a fresh clone fails 6 examples.Notes
openapi.valid?passes for 3.2.0 documents. Not required for this PR.register_operationextraction pushed the method pastMetrics/MethodLengthunder the RuboCop config now onmain, so response registration is split intoregister_responses. The now-unneededrubocop:disableonrouteris 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