Skip to content

Add support for HTTP QUERY verb (RFC 10008)#2844

Open
jonty-comp wants to merge 6 commits into
openapi-ts:mainfrom
jonty-comp:http-query-support
Open

Add support for HTTP QUERY verb (RFC 10008)#2844
jonty-comp wants to merge 6 commits into
openapi-ts:mainfrom
jonty-comp:http-query-support

Conversation

@jonty-comp

Copy link
Copy Markdown

Changes

This PR adds support for the HTTP QUERY method (RFC 10008) to openapi-typescript and openapi-fetch.

The QUERY method is a safe, idempotent HTTP method that carries a request body, filling the gap between GET (no body) and POST/PUT (non-idempotent). OpenAPI 3.2 recognises query as a valid HTTP method verb, and it passes through YAML->JSON conversion correctly, but openapi-typescript's code generator treated it as an unknown property and silently dropped it, so no TypeScript types were produced.

This change adds "query" to the HttpMethod union type and the internal Method type, includes it in all method iteration and validation arrays across the transformer pipeline, adds QUERY() to the openapi-fetch client, and updates all test snapshots and fixtures accordingly.

References:

How to Review

My principal concern in adding this feature is that all output types will be modified, even if they do not make use of query anywhere - which could confuse downstream consumers when all their fixtures suddenly change.

OpenAPI 3.2 also adds support for other custom HTTP methods through the additionalOperations parameter, but adding support for that would be a much wider impact; as the query method is listed as a first-class method under the RFC, I considered it worth adding in its own changeset.

One small change I made that might be incorrect/intentionally different: I noted that the simple-example.ts example schema is not regenerated along with the rest, due to it not being present in schemas.ts. I added it so it is regenerated automatically with update-examples.ts from the local schema file, rather than modifying the generated file by hand to get the tests to pass.

Checklist

  • Unit tests updated
  • docs/ updated (if necessary)
  • pnpm run update:examples run (only applicable for openapi-typescript)

@jonty-comp jonty-comp requested a review from a team as a code owner July 15, 2026 14:59
@jonty-comp jonty-comp requested review from Copilot and drwpow July 15, 2026 14:59
@netlify

netlify Bot commented Jul 15, 2026

Copy link
Copy Markdown

👷 Deploy request for openapi-ts pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 0dff4fc

@changeset-bot

changeset-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 0dff4fc

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds first-class support for the HTTP QUERY method across the OpenAPI type generator (openapi-typescript) and the runtime client (openapi-fetch), so OpenAPI 3.2 query operations are no longer silently dropped and can be called via typed client APIs.

Changes:

  • Extend OpenAPI/HTTP method unions and path-item typing to include query, and iterate/validate it through the transform pipeline.
  • Add QUERY() to the openapi-fetch client surface (runtime + type declarations).
  • Update fixtures/snapshots and generated example outputs to include query?: never where appropriate.

Reviewed changes

Copilot reviewed 19 out of 42 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/openapi-typescript/test/yaml.test.ts Snapshot update to include query?: never in generated output.
packages/openapi-typescript/test/transform/webhooks-object.test.ts Snapshot update for webhook path-items to include query?: never.
packages/openapi-typescript/test/transform/schema-object/enum.test.ts Snapshot updates to include query?: never in generated paths.
packages/openapi-typescript/test/transform/paths-object.test.ts Snapshot updates to include query?: never across path transforms.
packages/openapi-typescript/test/transform/path-item-object.test.ts Adds/validates a query operation transform and updates snapshots accordingly.
packages/openapi-typescript/test/transform/components-object.test.ts Snapshot updates to include query?: never in component-derived paths.
packages/openapi-typescript/test/node-api.test.ts Snapshot updates for Node API output to include query?: never.
packages/openapi-typescript/test/index.test.ts Snapshot updates for main index generator output to include query?: never.
packages/openapi-typescript/test/discriminators.test.ts Snapshot updates to include query?: never in discriminator fixture output.
packages/openapi-typescript/src/types.ts Extends PathItemObject to define `query?: OperationObject
packages/openapi-typescript/src/transform/paths-object.ts Ensures query is included when iterating operations for path-param extraction.
packages/openapi-typescript/src/transform/paths-enum.ts Allows query operations to contribute to the generated API paths enum.
packages/openapi-typescript/src/transform/path-item-object.ts Extends internal Method union and method iteration list to include query.
packages/openapi-typescript/scripts/schemas.ts Adds simple-example to the schema list used by example generation scripts.
packages/openapi-typescript/examples/stripe-api.ts Regenerated example output reflecting the new query?: never method slot.
packages/openapi-typescript/examples/simple-example.ts Regenerated example output reflecting the new query?: never method slot.
packages/openapi-typescript/examples/octokit-ghes-3.6-diff-to-api.ts Regenerated example output reflecting the new query?: never method slot.
packages/openapi-typescript/examples/digital-ocean-api.ts Regenerated example output reflecting the new query?: never method slot.
packages/openapi-typescript-helpers/src/index.ts Extends exported HttpMethod union with "query".
packages/openapi-react-query/test/fixtures/api.d.ts Fixture update to include query?: never in paths.
packages/openapi-fetch/test/read-write-visibility/schemas/read-write.d.ts Fixture update to include query?: never in paths.
packages/openapi-fetch/test/path-based-client/schemas/path-based-client.d.ts Fixture update to include query?: never in paths.
packages/openapi-fetch/test/middleware/schemas/middleware.d.ts Fixture update to include query?: never in paths.
packages/openapi-fetch/test/http-methods/schemas/trace.d.ts Fixture update to include query?: never in paths.
packages/openapi-fetch/test/http-methods/schemas/put.d.ts Fixture update to include query?: never in paths.
packages/openapi-fetch/test/http-methods/schemas/post.d.ts Fixture update to include query?: never in paths.
packages/openapi-fetch/test/http-methods/schemas/patch.d.ts Fixture update to include query?: never in paths.
packages/openapi-fetch/test/http-methods/schemas/options.d.ts Fixture update to include query?: never in paths.
packages/openapi-fetch/test/http-methods/schemas/head.d.ts Fixture update to include query?: never in paths.
packages/openapi-fetch/test/http-methods/schemas/get.d.ts Fixture update to include query?: never in paths.
packages/openapi-fetch/test/http-methods/schemas/delete.d.ts Fixture update to include query?: never in paths.
packages/openapi-fetch/test/common/schemas/common.d.ts Fixture update to include query?: never in paths.
packages/openapi-fetch/src/index.js Adds runtime QUERY() method to the core client.
packages/openapi-fetch/src/index.d.ts Adds typed QUERY: ClientMethod<..., "query", ...> to the client interface.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/openapi-fetch/src/index.js
Comment thread packages/openapi-typescript/scripts/schemas.ts
Comment thread packages/openapi-fetch/src/index.js
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