Skip to content

feat: support the HTTP QUERY method (RFC 10008) - #1702

Open
tmeghe wants to merge 7 commits into
PaloAltoNetworks:mainfrom
tmeghe:feat/query-method
Open

tmeghe wants to merge 7 commits into
PaloAltoNetworks:mainfrom
tmeghe:feat/query-method

Conversation

@tmeghe

@tmeghe tmeghe commented Nov 4, 2026 •

Copy link
Copy Markdown

Description

RFC 10008 standardises the HTTP QUERY method: a safe, idempotent request that carries its query in the request body. OpenAPI 3.2 adds query as a fixed field of the Path Item Object.

Today a query operation gets no page. Since #1440, path items are filtered through an HTTP method list that has no query. Even before #1440, it had no code samples (openapi-to-postmanv2 < 6.4.0 ignores query) and no badge colour (badge--undefined).

Changes

  • plugin:
    • create pages for query operations, for OpenAPI 3.2 and later only. query is a Path Item field only from 3.2, so older specs skip it like any unknown key;
    • share one HTTP method list (HTTP_METHODS in src/openapi/httpMethods.ts), now with query. The page filter, the Postman servers cleanup, the callback tabs and isOperationName all use it, so isOperationName also gains trace;
    • add query to the Path Item types.
  • plugin: require openapi-to-postmanv2 ^6.4.0, the first version that builds a QUERY request (only for openapi: 3.2.x specs). The lock keeps the 6.4.2 from chore(deps): bump openapi-to-postmanv2 from 6.3.3 to 6.4.2 #1701.
  • theme: the QUERY badge uses the GET colour (badge--primary). Like GET, it is a safe and idempotent read, and the six Infima badge colours are all taken.
  • demo:
    • add a "Search Cakes" query operation to the OpenAPI 3.2 bakery example;
    • add the query sidebar label to the demo styles, to the palette themes (src/css/themes and the served copies in static/themes, using GET colours), and to the styling docs snippets.
  • template: add the query sidebar label to the create-docusaurus-openapi-docs template, with the GET colour.

Tests

  • openapi.test.ts:
    • an OpenAPI 3.2 spec gives a QUERY page bound to a QUERY Postman request, next to a GET on the same path;
    • an OpenAPI 3.1 spec skips the query operation and keeps the GET.
  • createCallbacks.test.ts (new): the QUERY callback tab.
  • utils/utils/openapi.test.ts (new): isOperationName accepts query, trace and $ref.
  • MethodEndpoint/index.test.ts (new): the QUERY badge colour.

Each new test fails on main, except the 3.1 case, which main already skips. On Node 24, yarn test passes 661/661 and yarn build-packages passes. Prettier and eslint report nothing new on the touched files.

Checked in the demo:

  • the badge and the sidebar label;
  • the curl sample (curl -L -X QUERY '…/cakes/search' -H 'Content-Type: application/json' -d '{…}');
  • "Send API Request" sends QUERY, tested with a temporary servers entry.

Note: some local checks already fail on main and are not touched here:

  • yarn lint crashes on cypress/.eslintrc.js: env cypress/globals is unknown with eslint-plugin-cypress 7;
  • eslint reports react-hooks/rules-of-hooks in MethodEndpoint/index.tsx;
  • yarn format flags files that are already unformatted, including utils/types.ts and utils/types/open-api.ts, which get a one-line type here.

🤖 Generated with Claude Code

tmeghe and others added 3 commits November 4, 2026 09:15
QUERY is standardised by RFC 10008 and OpenAPI 3.2 adds `query` as a
fixed field of the Path Item Object. Since the path-level vendor
extension fix (PaloAltoNetworks#1440), operations are filtered through an HTTP method
list without `query`, so QUERY operations got no page at all.

- generate pages for `query` operations (and their callbacks)
- strip their `servers` before the Postman conversion, like other verbs
- require openapi-to-postmanv2 ^6.4.0, the first version that builds a
  QUERY request (for `openapi: 3.2.x` specs), so code samples and the
  API explorer send QUERY

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
QUERY had no badge colour (`badge--undefined`). Give it the GET colour:
like GET, QUERY is a safe and idempotent read (RFC 10008), and the six
Infima badge colours are all taken.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- add a `query` operation (Search Cakes) to the OpenAPI 3.2 bakery example
- add the `query` sidebar method label to the demo styles, the palette
  themes (GET colours) and the styling docs snippets

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@sserrata sserrata left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding QUERY support. One bug must be fixed before merge, and a few smaller items are listed below.

Other items (outside the diff):

  • packages/create-docusaurus-openapi-docs/templates/default/src/css/custom.css: The project template has no .query sidebar badge rule, so new sites show QUERY operations with no method label. Please add the same rule as in the demo.

"head",
"patch",
"trace",
"query",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: query is now handled for every spec version, but openapi-to-postmanv2 builds a request only for OpenAPI 3.2. For a 3.0 or 3.1 spec with paths./x.query, the page has api.postman undefined. The explorer then uses new sdk.Request(undefined), which defaults to GET, so Send calls fetch with GET and a body and the browser rejects it. The snippets also show GET. The test 'creates a page without a request for query operations before OpenAPI 3.2' accepts this state. Please include query only for openapi >= 3.2, or build a fallback request from the method and path when the converter returns none.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks! I went with your first option: query now only makes a page for OpenAPI 3.2+, so older specs skip it like any unknown key. The 3.1 test checks that now (feba142).

delete pathItemObject.head?.servers;
delete pathItemObject.patch?.servers;
delete pathItemObject.trace?.servers;
delete pathItemObject.query?.servers;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The HTTP method list is copied in four places: this servers cleanup, HTTP_METHODS, the callbacks Map in createCallbacks.ts, and operationNames in src/openapi/utils/utils/openapi.ts. operationNames still has no query, so isOperationName("query") is false. Please export one method list and use it in all four places.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in cb2eba7: one HTTP_METHODS list in src/openapi/httpMethods.ts, used in all four places. I kept it alphabetical so the callback tabs keep their order, and isOperationName now knows trace and query too.

Comment thread yarn.lock
version "6.3.3"
resolved "https://registry.yarnpkg.com/openapi-to-postmanv2/-/openapi-to-postmanv2-6.3.3.tgz#b249c923a3093f316bc0e191d92abf49bb3736b9"
integrity sha512-o0u6qqMMRLt7eAyFBpL/lCresQ1VqQFGe6/iPMBvNkWDXrpgGo5jo+YnP1e0MwF3tdUKLfkHssufGWMdojpPLg==
openapi-to-postmanv2@^6.4.0:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This now conflicts with main: #1701 already moved openapi-to-postmanv2 to 6.4.2. Please merge main and run yarn install so that the lock entry matches the new ^6.4.0 range.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merged main in cab2543. The entry is now openapi-to-postmanv2@^6.4.0, at the same 6.4.2 as #1701, and yarn install leaves it as is.


.get > .menu__link::before {
.get > .menu__link::before,
.query > .menu__link::before {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not blocking: the same .query rules are copied into 14 theme files (7 in demo/src/css/themes, 7 in demo/static/themes). If a shared GET/QUERY rule is possible, it would be easier to maintain.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a look, but each palette hard-codes its colours per selector (no variables), so sharing them would mean reworking all seven palettes. For now each rule is a single GET/QUERY selector list. Happy to do that refactor in a follow-up.

tmeghe and others added 4 commits November 5, 2026 20:32
Keep the openapi-to-postmanv2@^6.4.0 lock entry, which resolves to the
6.4.2 that PaloAltoNetworks#1701 already locks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`query` is a Path Item field only from OpenAPI 3.2, the first version
openapi-to-postmanv2 builds a QUERY request for. A `query` key in an
older spec gave a page with no request, so the explorer sent GET with
a body and the code samples showed GET. Skip it, like any other
unknown path item key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Postman `servers` cleanup, the page filter, the callback tabs and
`isOperationName` each had their own copy of the HTTP methods, and
`isOperationName` still missed `trace` and `query`. They now all read
`HTTP_METHODS`, kept in alphabetical order so the callback tab order
does not change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
New sites from create-docusaurus-openapi-docs now label QUERY
operations in the sidebar, with the GET colour like the method badge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tmeghe

tmeghe commented Nov 5, 2026

Copy link
Copy Markdown
Author

Thanks for the review! I also added the .query sidebar label to the create-docusaurus-openapi-docs template in ef10ad5, with the GET colour like the badge.

@tmeghe
tmeghe requested a review from sserrata November 5, 2026 19:42

This branch is waiting to be deployed

1 waiting deployment
default — ef10ad5c Waiting Nov 5, 2026 by tmeghe via Analyze Unsafe (javascript) #2479
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