feat: add QUERY method (RFC 10008) to PathItemProps#289
Open
thdxg wants to merge 1 commit into
Open
Conversation
The HTTP QUERY method (RFC 10008) is a safe, idempotent, cacheable method that carries a request body, and is a valid Path Item operation in OpenAPI 3.2. Add a Query field to PathItemProps so QUERY endpoints can be represented and round-tripped, and include it in the operation walk during $ref expansion. Fixes go-openapi#287 Signed-off-by: Ethan (Taehoon) Lee <48551278+thdxg@users.noreply.github.com>
Member
|
Thank you for this proposal. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #289 +/- ##
==========================================
+ Coverage 67.08% 67.09% +0.01%
==========================================
Files 30 30
Lines 2415 2416 +1
==========================================
+ Hits 1620 1621 +1
Misses 626 626
Partials 169 169 ☔ View full report in Codecov by Harness. |
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.
Change type
🆕 New feature or enhancement
Short description
Add a
Queryoperation field toPathItemPropsso the HTTPQUERYmethod (RFC 10008) can be represented and round-tripped.Fixes
Fixes #288
Full description
QUERYis a safe, idempotent, cacheable HTTP method that carries a request body (semantics per RFC 9110), and it is a valid Path Item operation in OpenAPI 3.2.PathItemPropspreviously had no field to hold it, so a QUERY endpoint could not be modeled.Changes:
path_item.go: addQuery *Operationwith thequeryJSON tag. The struct (de)serializes via reflection over its fields, so no changes toMarshalJSON/UnmarshalJSON/JSONLookupare needed.expander.go: includepathItem.Queryin the operation slice walked during$refexpansion.path_item_test.go: extend theTestIntegrationPathItemround-trip fixture to coverquery.Scope note: this package models Swagger/OpenAPI 2.0, where
queryis not a formally defined Path Item field. The field is additive, marshals cleanly to the expected"query": { ... }output, and unblocks downstream tooling (swaggo/swag#2193). Happy to adjust if maintainers prefer a different approach — see the discussion in #287.Checklist