Skip to content

feat: add QUERY method (RFC 10008) to PathItemProps#289

Open
thdxg wants to merge 1 commit into
go-openapi:masterfrom
thdxg:feat/query-method
Open

feat: add QUERY method (RFC 10008) to PathItemProps#289
thdxg wants to merge 1 commit into
go-openapi:masterfrom
thdxg:feat/query-method

Conversation

@thdxg

@thdxg thdxg commented Jul 11, 2026

Copy link
Copy Markdown

Change type

🆕 New feature or enhancement

Short description

Add a Query operation field to PathItemProps so the HTTP QUERY method (RFC 10008) can be represented and round-tripped.

Fixes

Fixes #288

Full description

QUERY is 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. PathItemProps previously had no field to hold it, so a QUERY endpoint could not be modeled.

Changes:

  • path_item.go: add Query *Operation with the query JSON tag. The struct (de)serializes via reflection over its fields, so no changes to MarshalJSON / UnmarshalJSON / JSONLookup are needed.
  • expander.go: include pathItem.Query in the operation slice walked during $ref expansion.
  • path_item_test.go: extend the TestIntegrationPathItem round-trip fixture to cover query.

Scope note: this package models Swagger/OpenAPI 2.0, where query is 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

  • I have signed all my commits with my name and email (see DCO). This does not require a PGP-signed commit
  • I have rebased and squashed my work, so only one commit remains
  • I have added tests to cover my changes.
  • I have properly enriched go doc comments in code.
  • I have properly documented any breaking change. (None — additive field.)

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>
@fredbi

fredbi commented Jul 11, 2026

Copy link
Copy Markdown
Member

Thank you for this proposal.
We are departing from the swagger 2.0 spec Too much, so this is a likely decline.
Perhaps for a future version of the same functionality, but that will not happen in the current repo which remains locked on oai2.

@fredbi fredbi closed this Jul 11, 2026
@fredbi fredbi reopened this Jul 12, 2026
@codecov

codecov Bot commented Jul 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.09%. Comparing base (da6a6cf) to head (554e635).
⚠️ Report is 4 commits behind head on master.
✅ All tests successful. No failed tests found.

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.
📢 Have feedback on the report? Share it here.

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.

Support the HTTP QUERY method (RFC 10008) on PathItemProps

2 participants