Skip to content

openapi3: support OAS 3.2 query and additionalOperations - #1240

Merged
fenollp merged 1 commit into
getkin:masterfrom
mromaszewicz:feat/custom-methods
Aug 5, 2026
Merged

fenollp merged 1 commit into
getkin:masterfrom
mromaszewicz:feat/custom-methods

Conversation

@mromaszewicz

Copy link
Copy Markdown
Contributor

Add the OpenAPI 3.2 Path Item Object fields for custom HTTP methods: the fixed query field (HTTP QUERY) and additionalOperations, a map of custom method names to operations.

  • PathItem gains Query and AdditionalOperations; Operations(), GetOperation() and SetOperation() cover them. SetOperation no longer panics on unknown methods; they are stored in AdditionalOperations.
  • Both fields are version-gated: validating a pre-3.2 document that uses them fails with query-field-for-3-2-plus / additional-operations-field-for-3-2-plus. AdditionalOperations keys must be RFC 9110 tokens and must not duplicate a fixed-field method.
  • Schema/parameter walkers address custom methods with /additionalOperations/ JSON pointers, preserving case.
  • openapi2conv.FromV3 and FromV3PathItem return an error instead of panicking for methods Swagger 2.0 cannot express.
  • routers/legacy: guard a nil-node dereference in the FindRoute fallback when the document declares an operation absent from the route trie.
  • Routers and openapi3filter need no changes: both derive method sets from Operations(), proven by new routing and request-validation tests for QUERY and custom methods.

Add the OpenAPI 3.2 Path Item Object fields for custom HTTP methods:
the fixed query field (HTTP QUERY) and additionalOperations, a map of
custom method names to operations.

- PathItem gains Query and AdditionalOperations; Operations(),
  GetOperation() and SetOperation() cover them. SetOperation no longer
  panics on unknown methods; they are stored in AdditionalOperations.
- Both fields are version-gated: validating a pre-3.2 document that
  uses them fails with query-field-for-3-2-plus /
  additional-operations-field-for-3-2-plus. AdditionalOperations keys
  must be RFC 9110 tokens and must not duplicate a fixed-field method.
- Schema/parameter walkers address custom methods with
  /additionalOperations/<METHOD> JSON pointers, preserving case.
- openapi2conv.FromV3 and FromV3PathItem return an error instead of
  panicking for methods Swagger 2.0 cannot express.
- routers/legacy: guard a nil-node dereference in the FindRoute
  fallback when the document declares an operation absent from the
  route trie.
- Routers and openapi3filter need no changes: both derive method sets
  from Operations(), proven by new routing and request-validation
  tests for QUERY and custom methods.

Co-Authored-By: Claude Fable 5 <[email protected]>
@fenollp
fenollp merged commit 5d526a9 into getkin:master Aug 5, 2026
5 checks passed
@fenollp

fenollp commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Thanks!

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