Skip to content

feat: support HTTP QUERY operations - #4456

Open
nrutman wants to merge 5 commits into
hey-api:mainfrom
nrutman:feat/http-query-support
Open

nrutman wants to merge 5 commits into
hey-api:mainfrom
nrutman:feat/http-query-support

Conversation

@nrutman

@nrutman nrutman commented Oct 1, 2026 •

Copy link
Copy Markdown

Summary

  • Adds OpenAPI 3.2 QUERY parsing for paths and webhooks.
  • Generates typed client.query() calls across supported clients and query plugins.
  • Adds QUERY support for custom clients, mixed-version bundles, parser filters, patches, and MSW handlers.
Review map: 23.7% hand-authored / 76.3% generated
Category Changed lines Share
Implementation 342 8.2%
Tests 576 13.8%
Fixtures 61 1.5%
Metadata 8 0.2%
Generated output 3,179 76.3%
Total 4,166 100%

Implementation

File Changed lines
packages/custom-client/src/client.ts 1
packages/custom-client/src/core/types.ts 13
packages/json-schema-ref-parser/src/index.ts 67
packages/openapi-ts/src/plugins/@hey-api/client-angular/bundle/client.ts 2
packages/openapi-ts/src/plugins/@hey-api/client-axios/bundle/client.ts 2
packages/openapi-ts/src/plugins/@hey-api/client-core/bundle/types.ts 1
packages/openapi-ts/src/plugins/@hey-api/client-fetch/bundle/client.ts 2
packages/openapi-ts/src/plugins/@hey-api/client-ky/bundle/client.ts 2
packages/openapi-ts/src/plugins/@hey-api/client-next/bundle/client.ts 2
packages/openapi-ts/src/plugins/@hey-api/client-nuxt/bundle/client.ts 17
packages/openapi-ts/src/plugins/@hey-api/client-ofetch/bundle/client.ts 2
packages/openapi-ts/src/plugins/msw/shared/handler.ts 119
packages/openapi-ts/src/symbols/msw.ts 1
packages/shared/src/ir/graph.ts 4
packages/shared/src/ir/types.ts 1
packages/shared/src/openApi/2.0.x/parser/filter.ts 4
packages/shared/src/openApi/2.0.x/parser/index.ts 2
packages/shared/src/openApi/2.0.x/parser/validate.ts 4
packages/shared/src/openApi/3.0.x/parser/filter.ts 4
packages/shared/src/openApi/3.0.x/parser/index.ts 2
packages/shared/src/openApi/3.0.x/parser/validate.ts 4
packages/shared/src/openApi/3.1.x/parser/filter.ts 4
packages/shared/src/openApi/3.1.x/parser/index.ts 21
packages/shared/src/openApi/3.1.x/parser/validate.ts 4
packages/shared/src/openApi/3.1.x/parser/webhook.ts 19
packages/shared/src/openApi/shared/graph/meta.ts 5
packages/shared/src/openApi/shared/utils/filter.ts 6
packages/shared/src/openApi/shared/utils/operation.ts 9
packages/shared/src/openApi/shared/utils/patch.ts 7
packages/shared/src/plugins/shared/utils/instance.ts 1
packages/spec-types/src/openapi/v3-1/spec.ts 10

Tests

File Changed lines
packages/custom-client/src/__tests__/client.test.ts 18
packages/json-schema-ref-parser/src/__tests__/bundle.test.ts 86
packages/openapi-ts-tests/main/test/3.2.x.test.ts 77
packages/openapi-ts-tests/msw/v2/test/3.2.x.test.ts 37
packages/openapi-ts/src/plugins/@hey-api/client-fetch/__tests__/client.test.ts 30
packages/shared/src/ir/__tests__/graph.test.ts 2
packages/shared/src/openApi/3.1.x/parser/__tests__/filter.test.ts 54
packages/shared/src/openApi/3.1.x/parser/__tests__/index.test.ts 48
packages/shared/src/openApi/3.1.x/parser/__tests__/validate.test.ts 53
packages/shared/src/openApi/shared/utils/__tests__/filter.test.ts 51
packages/shared/src/openApi/shared/utils/__tests__/graph.test.ts 20
packages/shared/src/openApi/shared/utils/__tests__/patch.test.ts 100

Fixtures

File Changed lines
packages/openapi-ts-tests/main/test/custom/client/client.ts 1
packages/openapi-ts-tests/main/test/custom/client/core/types.ts 13
specs/3.2.x/http-query.yaml 47

Metadata

File Changed lines
.changeset/fuzzy-bears-query.md 8

Linked issues

Related to: #2660

Testing

  1. pnpm lint
  2. pnpm typecheck
  3. pnpm test -- --run
  4. pnpm examples:update (idempotence verified)

Certification

  • I have personally reviewed every line of this contribution and take responsibility for its correctness.

@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@vercel

vercel Bot commented Oct 1, 2026

Copy link
Copy Markdown

@nrutman is attempting to deploy a commit to the Hey API Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot

changeset-bot Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 61e759c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@hey-api/openapi-ts Minor
@hey-api/json-schema-ref-parser Patch
@hey-api/shared Minor
@hey-api/spec-types Minor
@hey-api/openapi-python Patch

Not sure what this means? Click here to learn what changesets are.

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

@hey-api

hey-api Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Pull request checklist

A few things need attention before this pull request can be merged:

  • Certification checkbox is present but unchecked. Check it only once you have reviewed and verified the code in this pull request.

Update the description and this check re-runs automatically.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important

@hey-api/custom-client's Client/Config types were not updated alongside the new query method, producing a TS2353 error when the package is type-checked and leaving its public type out of sync with its runtime.

Reviewed changes

  • Parser — adds query to the shared httpMethods list and parses QUERY operations from paths and webhooks, gated to >=3.2.0 (packages/shared/src/openApi/3.1.x/parser/{index,webhook}.ts).
  • IR & spec types — adds query to IRPathItemObject and OpenAPIV3.PathItemObject, the '3.2.0' version literal, and the irPatterns regexes.
  • Clients — adds query: makeMethodFn('QUERY') (and the SSE variant) across the bundled Angular/Axios/fetch/ky/next/Nuxt/ofetch clients and @hey-api/custom-client.
  • Plugins — maps query to the query kind in defaultGetKind and generates client.query(...) SDK calls.
  • Tests/snapshots — new 3.2.x.test.ts plus specs/3.2.x/http-query.yaml, parser version-boundary unit tests, a fetch runtime body test, and regenerated snapshots.

ℹ️ Other method enumerations still omit query

Two hard-coded HTTP-method lists were not extended, so QUERY operations are invisible to those code paths even though the shared httpMethods now includes them.

Technical details
# Hard-coded method lists missing `query`

## Affected sites
- `packages/shared/src/openApi/shared/utils/patch.ts:62` and `:166` — the bulk `patch.operations` callback iterates `['get','put','post','delete','options','head','patch','trace']`; a `QUERY` operation is silently skipped, so user patch functions never see it (the record-based branch at `:79`/`:183` does work via `key.split(' ')`).
- `packages/json-schema-ref-parser/src/index.ts:551` — `HTTP_METHODS` set omits `query`, so when merging multi-file specs a `QUERY` method conflict on the same path is not detected and the operation can be overwritten instead of namespaced.

## Required outcome
- `query` should be handled consistently in both utilities, matching the new shared `httpMethods` list.

## Suggested approach (optional)
- Derive these lists from `httpMethods` (uppercasing for the parser set) rather than duplicating literals to avoid the same drift later.

ℹ️ Nitpicks

  • packages/openapi-ts-tests/main/test/3.2.x.test.ts reimplements a simplified createConfig that diverges from the helper in 3.0.x.test.ts/3.1.x.test.ts (no array input/output handling, no nameConflictResolver passthrough), and only one scenario is covered. Worth aligning before the 3.2 suite grows.
  • packages/openapi-ts/src/plugins/@hey-api/client-nuxt/bundle/client.ts:150 — method: opts.method as any is spread after ...asyncDataOptions, so it now always wins over a method supplied through asyncDataOptions (previously the latter won). This is likely intentional for QUERY typing, but it is a behavior change for direct request() calls where opts.method is undefined.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

Comment thread packages/custom-client/src/client.ts
@codecov

codecov Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 41.16%. Comparing base (d6ba11f) to head (61e759c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4456      +/-   ##
==========================================
+ Coverage   40.56%   41.16%   +0.59%     
==========================================
  Files         827      827              
  Lines       25727    25762      +35     
  Branches     7687     7687              
==========================================
+ Hits        10436    10604     +168     
+ Misses      12319    12231      -88     
+ Partials     2972     2927      -45     
Flag Coverage Δ
unittests 41.16% <100.00%> (+0.59%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pkg-pr-new

pkg-pr-new Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@hey-api/codegen-cli

npm i https://pkg.pr.new/@hey-api/codegen-cli@4456

@hey-api/codegen-core

npm i https://pkg.pr.new/@hey-api/codegen-core@4456

@hey-api/json-schema-ref-parser

npm i https://pkg.pr.new/@hey-api/json-schema-ref-parser@4456

@hey-api/nuxt

npm i https://pkg.pr.new/@hey-api/nuxt@4456

@hey-api/openapi-python

npm i https://pkg.pr.new/@hey-api/openapi-python@4456

@hey-api/openapi-ts

npm i https://pkg.pr.new/@hey-api/openapi-ts@4456

@hey-api/shared

npm i https://pkg.pr.new/@hey-api/shared@4456

@hey-api/spec-types

npm i https://pkg.pr.new/@hey-api/spec-types@4456

@hey-api/types

npm i https://pkg.pr.new/@hey-api/types@4456

@hey-api/vite-plugin

npm i https://pkg.pr.new/@hey-api/vite-plugin@4456

commit: 61e759c

This branch has not been deployed

No deployments
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.

1 participant