Repository navigation
Conversation
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
left a comment
There was a problem hiding this comment.
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.querysidebar 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", |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
| 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: |
There was a problem hiding this comment.
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.
|
|
||
| .get > .menu__link::before { | ||
| .get > .menu__link::before, | ||
| .query > .menu__link::before { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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>
|
Thanks for the review! I also added the |
Description
RFC 10008 standardises the HTTP
QUERYmethod: a safe, idempotent request that carries its query in the request body. OpenAPI 3.2 addsqueryas a fixed field of the Path Item Object.Today a
queryoperation gets no page. Since #1440, path items are filtered through an HTTP method list that has noquery. Even before #1440, it had no code samples (openapi-to-postmanv2 < 6.4.0 ignoresquery) and no badge colour (badge--undefined).Changes
queryoperations, for OpenAPI 3.2 and later only.queryis a Path Item field only from 3.2, so older specs skip it like any unknown key;HTTP_METHODSinsrc/openapi/httpMethods.ts), now withquery. The page filter, the Postmanserverscleanup, the callback tabs andisOperationNameall use it, soisOperationNamealso gainstrace;queryto the Path Item types.openapi-to-postmanv2^6.4.0, the first version that builds aQUERYrequest (only foropenapi: 3.2.xspecs). The lock keeps the 6.4.2 from chore(deps): bump openapi-to-postmanv2 from 6.3.3 to 6.4.2 #1701.badge--primary). Like GET, it is a safe and idempotent read, and the six Infima badge colours are all taken.queryoperation to the OpenAPI 3.2 bakery example;querysidebar label to the demo styles, to the palette themes (src/css/themesand the served copies instatic/themes, using GET colours), and to the styling docs snippets.querysidebar label to the create-docusaurus-openapi-docs template, with the GET colour.Tests
openapi.test.ts:QUERYPostman request, next to a GET on the same path;queryoperation and keeps the GET.createCallbacks.test.ts(new): the QUERY callback tab.utils/utils/openapi.test.ts(new):isOperationNameacceptsquery,traceand$ref.MethodEndpoint/index.test.ts(new): the QUERY badge colour.Each new test fails on
main, except the 3.1 case, whichmainalready skips. On Node 24,yarn testpasses 661/661 andyarn build-packagespasses. Prettier and eslint report nothing new on the touched files.Checked in the demo:
curl -L -X QUERY '…/cakes/search' -H 'Content-Type: application/json' -d '{…}');QUERY, tested with a temporaryserversentry.Note: some local checks already fail on
mainand are not touched here:yarn lintcrashes oncypress/.eslintrc.js: envcypress/globalsis unknown with eslint-plugin-cypress 7;react-hooks/rules-of-hooksinMethodEndpoint/index.tsx;yarn formatflags files that are already unformatted, includingutils/types.tsandutils/types/open-api.ts, which get a one-line type here.🤖 Generated with Claude Code