From ffa0161fe52553dbac4ec41e5058dc1920a71f4a Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Thu, 23 Oct 2025 05:32:33 +0000
Subject: [PATCH] Resolve merge conflicts with main branch
Merged latest changes from main and regenerated all affected snapshots.
All snapshot conflicts resolved by regenerating with current changes.
Test status: 612/613 tests pass (99.8%)
- 1 known edge case with custom read/write naming remains
Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>
---
.github/workflows/ci.yml | 4 +
.vscode/settings.json | 3 +-
.../community/contributing/developing.md | 46 +
docs/partials/contributors-list.md | 1 +
eslint-rules/local-paths.js | 233 +++
eslint.config.js | 4 +
examples/README.md | 84 +
.../http/resources.gen.ts => common.gen.ts} | 334 +++-
.../@angular/common/http/requests.gen.ts | 295 ----
.../src/client/client.gen.ts | 13 +-
.../src/client/client/client.gen.ts | 15 +-
.../src/client/client/index.ts | 1 +
.../src/client/client/utils.gen.ts | 72 +-
.../src/client/core/queryKeySerializer.gen.ts | 136 ++
.../src/client/core/utils.gen.ts | 31 +-
.../src/client/index.ts | 6 +-
.../src/client/sdk.gen.ts | 63 +-
.../src/client/types.gen.ts | 8 +-
.../src/client/client.gen.ts | 13 +-
.../src/client/client/client.gen.ts | 15 +-
.../src/client/client/index.ts | 1 +
.../src/client/client/utils.gen.ts | 72 +-
.../src/client/core/queryKeySerializer.gen.ts | 136 ++
.../src/client/core/utils.gen.ts | 31 +-
.../openapi-ts-angular/src/client/index.ts | 3 +-
.../openapi-ts-angular/src/client/sdk.gen.ts | 63 +-
.../src/client/types.gen.ts | 8 +-
.../openapi-ts-axios/src/client/client.gen.ts | 13 +-
.../src/client/client/client.gen.ts | 66 +-
.../src/client/client/index.ts | 1 +
.../src/client/client/types.gen.ts | 73 +-
.../src/client/client/utils.gen.ts | 121 +-
.../src/client/core/queryKeySerializer.gen.ts | 136 ++
.../src/client/core/serverSentEvents.gen.ts | 264 ++++
.../src/client/core/types.gen.ts | 42 +-
.../src/client/core/utils.gen.ts | 143 ++
examples/openapi-ts-axios/src/client/index.ts | 3 +-
.../openapi-ts-axios/src/client/sdk.gen.ts | 67 +-
.../openapi-ts-axios/src/client/types.gen.ts | 8 +-
.../src/client/client.gen.ts | 13 +-
.../src/client/client/client.gen.ts} | 127 +-
.../src/client/client/client.ts | 181 ---
.../src/client/client/index.ts | 18 +-
.../src/client/client/types.gen.ts} | 87 +-
.../src/client/client/utils.gen.ts} | 247 +--
.../src/client/core/{auth.ts => auth.gen.ts} | 2 +
.../src/client/core/bodySerializer.gen.ts} | 6 +-
.../src/client/core/params.gen.ts} | 2 +
.../src/client/core/pathSerializer.gen.ts} | 2 +
.../src/client/core/queryKeySerializer.gen.ts | 136 ++
.../src/client/core/serverSentEvents.gen.ts | 264 ++++
.../src/client/core/types.gen.ts} | 48 +-
.../src/client/core/utils.gen.ts | 143 ++
.../openapi-ts-fastify/src/client/index.ts | 3 +-
.../openapi-ts-fastify/src/client/sdk.gen.ts | 12 +-
.../src/client/types.gen.ts | 8 +-
.../openapi-ts-fetch/src/client/client.gen.ts | 13 +-
.../client/{client.ts => client.gen.ts} | 133 +-
.../src/client/client/index.ts | 18 +-
.../src/client/client/types.gen.ts} | 87 +-
.../client/client/{utils.ts => utils.gen.ts} | 247 +--
.../src/client/core/{auth.ts => auth.gen.ts} | 2 +
...odySerializer.ts => bodySerializer.gen.ts} | 20 +-
.../client/core/{params.ts => params.gen.ts} | 12 +
.../src/client/core/pathSerializer.gen.ts} | 2 +
.../src/client/core/queryKeySerializer.gen.ts | 136 ++
.../src/client/core/serverSentEvents.gen.ts | 264 ++++
.../client/core/{types.ts => types.gen.ts} | 62 +-
.../src/client/core/utils.gen.ts | 143 ++
examples/openapi-ts-fetch/src/client/index.ts | 3 +-
.../openapi-ts-fetch/src/client/sdk.gen.ts | 71 +-
.../openapi-ts-fetch/src/client/types.gen.ts | 16 +-
examples/openapi-ts-next/openapi-ts.config.ts | 2 +-
.../openapi-ts-next/src/client/client.gen.ts | 13 +-
.../src/client/client/client.gen.ts | 262 ++++
.../src/client/client/client.ts | 163 --
.../src/client/client/index.ts | 17 +-
.../client/client/{types.ts => types.gen.ts} | 90 +-
.../client/client/{utils.ts => utils.gen.ts} | 120 +-
.../src/client/core/{auth.ts => auth.gen.ts} | 2 +
.../src/client/core/bodySerializer.gen.ts} | 22 +-
.../src/client/core/params.gen.ts} | 12 +
.../src/client/core/pathSerializer.gen.ts} | 2 +
.../src/client/core/queryKeySerializer.gen.ts | 136 ++
.../src/client/core/serverSentEvents.gen.ts | 264 ++++
.../src/client/core/types.gen.ts} | 68 +-
.../src/client/core/utils.gen.ts | 143 ++
examples/openapi-ts-next/src/client/index.ts | 3 +-
.../openapi-ts-next/src/client/sdk.gen.ts | 71 +-
.../openapi-ts-next/src/client/types.gen.ts | 18 +-
.../src/client/client/index.ts | 1 +
.../src/client/core/queryKeySerializer.gen.ts | 136 ++
.../openapi-ts-ofetch/src/client/sdk.gen.ts | 19 +
.../src/client/client.gen.ts | 13 +-
.../src/client/client/client.gen.ts | 119 +-
.../src/client/client/index.ts | 1 +
.../src/client/client/types.gen.ts | 68 +-
.../src/client/client/utils.gen.ts | 207 +--
.../src/client/core/queryKeySerializer.gen.ts | 136 ++
.../src/client/core/serverSentEvents.gen.ts | 264 ++++
.../src/client/core/types.gen.ts | 42 +-
.../src/client/core/utils.gen.ts | 143 ++
.../openapi-ts-openai/src/client/index.ts | 1 +
.../openapi-ts-openai/src/client/sdk.gen.ts | 170 +-
.../openapi-ts-openai/src/client/types.gen.ts | 716 +++++++--
.../openapi-ts-pinia-colada/.eslintrc.cjs | 3 +-
.../src/client/@pinia/colada.gen.ts | 23 +-
.../src/client/client/index.ts | 1 +
.../src/client/sdk.gen.ts | 19 +
.../src/client/client.gen.ts | 15 +-
.../src/client/client/client.gen.ts | 268 ++++
.../src/client/client/index.ts | 18 +-
.../src/client/client/types.gen.ts} | 96 +-
.../src/client/client/utils.gen.ts} | 249 +--
.../src/client/core/{auth.ts => auth.gen.ts} | 2 +
.../src/client/core/bodySerializer.gen.ts} | 22 +-
.../src/client/core/params.gen.ts} | 12 +
.../src/client/core/pathSerializer.gen.ts} | 2 +
.../src/client/core/queryKeySerializer.gen.ts | 136 ++
.../src/client/core/serverSentEvents.gen.ts | 264 ++++
.../src/client/core/types.gen.ts} | 68 +-
.../src/client/core/utils.gen.ts | 143 ++
.../openapi-ts-sample/src/client/index.ts | 3 +-
.../openapi-ts-sample/src/client/sdk.gen.ts | 71 +-
.../openapi-ts-sample/src/client/types.gen.ts | 16 +-
.../openapi-ts-sample/src/client/zod.gen.ts | 18 +-
.../angular-query-experimental.gen.ts | 278 +---
.../src/client/client.gen.ts | 13 +-
.../src/client/client/client.gen.ts | 165 +-
.../src/client/client/index.ts | 1 +
.../src/client/client/types.gen.ts | 146 +-
.../src/client/client/utils.gen.ts | 91 +-
.../src/client/core/bodySerializer.gen.ts | 2 +
.../src/client/core/queryKeySerializer.gen.ts | 136 ++
.../src/client/core/serverSentEvents.gen.ts | 264 ++++
.../src/client/core/types.gen.ts | 42 +-
.../src/client/core/utils.gen.ts | 143 ++
.../src/client/index.ts | 3 +-
.../src/client/sdk.gen.ts | 67 +-
.../src/client/types.gen.ts | 8 +-
.../src/client/@tanstack/react-query.gen.ts | 279 ++--
.../src/client/client.gen.ts | 13 +-
.../src/client/client/client.gen.ts | 268 ++++
.../src/client/client/client.ts | 181 ---
.../src/client/client/index.ts | 18 +-
.../src/client/client/types.gen.ts} | 96 +-
.../src/client/client/utils.gen.ts} | 249 +--
.../src/client/core/auth.gen.ts | 42 +
.../src/client/core/auth.ts | 40 -
.../src/client/core/bodySerializer.gen.ts | 92 ++
.../src/client/core/bodySerializer.ts | 84 -
.../src/client/core/params.gen.ts | 153 ++
.../src/client/core/params.ts | 141 --
.../src/client/core/pathSerializer.gen.ts | 181 +++
.../src/client/core/pathSerializer.ts | 179 ---
.../src/client/core/queryKeySerializer.gen.ts | 136 ++
.../src/client/core/serverSentEvents.gen.ts | 264 ++++
.../src/client/core/types.gen.ts | 118 ++
.../src/client/core/types.ts | 98 --
.../src/client/core/utils.gen.ts | 143 ++
.../src/client/index.ts | 3 +-
.../src/client/sdk.gen.ts | 71 +-
.../src/client/types.gen.ts | 18 +-
.../src/client/@tanstack/svelte-query.gen.ts | 279 ++--
.../src/client/client.gen.ts | 13 +-
.../src/client/client/client.gen.ts | 268 ++++
.../src/client/client/client.ts | 181 ---
.../src/client/client/index.ts | 18 +-
.../src/client/client/types.gen.ts | 268 ++++
.../src/client/client/types.ts | 212 ---
.../src/client/client/utils.gen.ts | 336 ++++
.../src/client/client/utils.ts | 415 -----
.../src/client/core/auth.gen.ts | 42 +
.../src/client/core/auth.ts | 40 -
.../src/client/core/bodySerializer.gen.ts | 92 ++
.../src/client/core/bodySerializer.ts | 84 -
.../src/client/core/params.gen.ts | 153 ++
.../src/client/core/params.ts | 141 --
.../src/client/core/pathSerializer.gen.ts | 181 +++
.../src/client/core/pathSerializer.ts | 179 ---
.../src/client/core/queryKeySerializer.gen.ts | 136 ++
.../src/client/core/serverSentEvents.gen.ts | 264 ++++
.../src/client/core/types.gen.ts | 118 ++
.../src/client/core/types.ts | 98 --
.../src/client/core/utils.gen.ts | 143 ++
.../src/client/index.ts | 3 +-
.../src/client/sdk.gen.ts | 71 +-
.../src/client/types.gen.ts | 18 +-
.../.eslintrc.cjs | 3 +-
.../src/client/@tanstack/vue-query.gen.ts | 271 +---
.../src/client/client.gen.ts | 17 +-
.../src/client/client/client.gen.ts | 253 +++
.../src/client/client/client.ts | 173 ---
.../src/client/client/index.ts | 18 +-
.../client/client/{types.ts => types.gen.ts} | 74 +-
.../client/client/{utils.ts => utils.gen.ts} | 227 +--
.../src/client/core/{auth.ts => auth.gen.ts} | 2 +
...odySerializer.ts => bodySerializer.gen.ts} | 20 +-
.../client/core/{params.ts => params.gen.ts} | 12 +
...athSerializer.ts => pathSerializer.gen.ts} | 2 +
.../src/client/core/queryKeySerializer.gen.ts | 117 ++
.../src/client/core/serverSentEvents.gen.ts | 241 +++
.../client/core/{types.ts => types.gen.ts} | 58 +-
.../src/client/core/utils.gen.ts | 140 ++
.../src/client/index.ts | 3 +-
.../src/client/sdk.gen.ts | 75 +-
.../src/client/types.gen.ts | 18 +-
package.json | 5 +-
packages/codegen-core/CHANGELOG.md | 6 +
packages/codegen-core/package.json | 2 +-
.../codegen-core/src/__tests__/files.test.ts | 15 +
.../src/__tests__/symbols.test.ts | 13 +
packages/codegen-core/src/files/registry.ts | 8 +
packages/codegen-core/src/files/types.d.ts | 7 +
packages/codegen-core/src/symbols/registry.ts | 5 +
packages/codegen-core/src/symbols/types.d.ts | 7 +
.../src/vitest.base.config.ts | 3 +-
packages/custom-client/src/plugin.ts | 4 +-
packages/openapi-ts-tests/main/package.json | 5 +-
.../axios/client/client.gen.ts | 25 +-
.../react-query/axios/client/client.gen.ts | 25 +-
.../solid-query/axios/client/client.gen.ts | 25 +-
.../svelte-query/axios/client/client.gen.ts | 25 +-
.../vue-query/axios/client/client.gen.ts | 25 +-
.../plugins/valibot/default/valibot.gen.ts | 124 +-
.../3.0.x/content-types/client/client.gen.ts | 25 +-
.../client/client.gen.ts | 25 +-
.../axios/client/client.gen.ts | 25 +-
.../react-query/axios/client/client.gen.ts | 25 +-
.../solid-query/axios/client/client.gen.ts | 25 +-
.../svelte-query/axios/client/client.gen.ts | 25 +-
.../vue-query/axios/client/client.gen.ts | 25 +-
.../plugins/valibot/default/valibot.gen.ts | 272 ++--
.../3.0.x/validators/valibot.gen.ts | 14 +-
.../base-url-false/client/client.gen.ts | 25 +-
.../base-url-number/client/client.gen.ts | 25 +-
.../base-url-strict/client/client.gen.ts | 25 +-
.../base-url-string/client/client.gen.ts | 25 +-
.../clean-false/client/client.gen.ts | 25 +-
.../client-axios/default/client/client.gen.ts | 25 +-
.../client/client.gen.ts | 25 +-
.../sdk-client-optional/client/client.gen.ts | 25 +-
.../sdk-client-required/client/client.gen.ts | 25 +-
.../client/client.gen.ts | 25 +-
.../my-client/base-url-false/client/plugin.ts | 4 +-
.../base-url-number/client/plugin.ts | 4 +-
.../base-url-strict/client/plugin.ts | 4 +-
.../base-url-string/client/plugin.ts | 4 +-
.../clients/my-client/bundle/client/plugin.ts | 4 +-
.../my-client/default/client/plugin.ts | 4 +-
.../sdk-client-optional/client/plugin.ts | 4 +-
.../sdk-client-required/client/plugin.ts | 4 +-
.../3.1.x/content-types/client/client.gen.ts | 25 +-
.../client/client.gen.ts | 25 +-
.../axios/client/client.gen.ts | 25 +-
.../react-query/axios/client/client.gen.ts | 25 +-
.../solid-query/axios/client/client.gen.ts | 25 +-
.../svelte-query/axios/client/client.gen.ts | 25 +-
.../vue-query/axios/client/client.gen.ts | 25 +-
.../plugins/valibot/default/valibot.gen.ts | 284 ++--
.../3.1.x/sse-axios/client/client.gen.ts | 25 +-
.../validators-circular-ref-2/valibot.gen.ts | 2 +-
.../validators-circular-ref/valibot.gen.ts | 12 +-
.../3.1.x/validators-metadata/valibot.gen.ts | 28 +-
.../3.1.x/validators-types/valibot.gen.ts | 28 +-
.../3.1.x/validators/valibot.gen.ts | 28 +-
.../main/test/custom/client/plugin.ts | 4 +-
.../main/test/openapi-ts.config.ts | 34 +-
.../openapi-ts-tests/main/vitest.config.ts | 14 +-
.../2.0.x/mini/default/zod.gen.ts | 126 +-
.../__snapshots__/2.0.x/v3/default/zod.gen.ts | 124 +-
.../__snapshots__/2.0.x/v4/default/zod.gen.ts | 126 +-
.../3.0.x/mini/circular/zod.gen.ts | 56 +-
.../3.0.x/mini/default/zod.gen.ts | 262 ++--
.../3.0.x/mini/validators/zod.gen.ts | 18 +-
.../3.0.x/v3/circular/zod.gen.ts | 36 +-
.../__snapshots__/3.0.x/v3/default/zod.gen.ts | 260 ++--
.../3.0.x/v3/validators/zod.gen.ts | 14 +-
.../3.0.x/v4/circular/zod.gen.ts | 56 +-
.../__snapshots__/3.0.x/v4/default/zod.gen.ts | 262 ++--
.../3.0.x/v4/validators/zod.gen.ts | 18 +-
.../3.1.x/mini/default/zod.gen.ts | 274 ++--
.../mini/validators-circular-ref/zod.gen.ts | 12 +-
.../3.1.x/mini/validators-dates/zod.gen.ts | 32 +-
.../3.1.x/mini/validators-metadata/zod.gen.ts | 36 +-
.../3.1.x/mini/validators-types/zod.gen.ts | 40 +-
.../3.1.x/mini/validators/zod.gen.ts | 32 +-
.../__snapshots__/3.1.x/v3/default/zod.gen.ts | 272 ++--
.../v3/validators-circular-ref/zod.gen.ts | 10 +-
.../3.1.x/v3/validators-dates/zod.gen.ts | 28 +-
.../3.1.x/v3/validators-metadata/zod.gen.ts | 28 +-
.../3.1.x/v3/validators-types/zod.gen.ts | 36 +-
.../3.1.x/v3/validators/zod.gen.ts | 28 +-
.../__snapshots__/3.1.x/v4/default/zod.gen.ts | 274 ++--
.../v4/validators-circular-ref/zod.gen.ts | 12 +-
.../3.1.x/v4/validators-dates/zod.gen.ts | 32 +-
.../3.1.x/v4/validators-metadata/zod.gen.ts | 36 +-
.../3.1.x/v4/validators-types/zod.gen.ts | 40 +-
.../3.1.x/v4/validators/zod.gen.ts | 32 +-
.../openapi-ts-tests/zod/v3/vitest.config.ts | 14 +-
.../2.0.x/mini/default/zod.gen.ts | 126 +-
.../__snapshots__/2.0.x/v3/default/zod.gen.ts | 124 +-
.../__snapshots__/2.0.x/v4/default/zod.gen.ts | 126 +-
.../3.0.x/mini/circular/zod.gen.ts | 56 +-
.../3.0.x/mini/default/zod.gen.ts | 262 ++--
.../3.0.x/mini/validators/zod.gen.ts | 18 +-
.../3.0.x/v3/circular/zod.gen.ts | 36 +-
.../__snapshots__/3.0.x/v3/default/zod.gen.ts | 260 ++--
.../3.0.x/v3/validators/zod.gen.ts | 14 +-
.../3.0.x/v4/circular/zod.gen.ts | 56 +-
.../__snapshots__/3.0.x/v4/default/zod.gen.ts | 262 ++--
.../3.0.x/v4/validators/zod.gen.ts | 18 +-
.../3.1.x/mini/default/zod.gen.ts | 274 ++--
.../mini/validators-circular-ref/zod.gen.ts | 12 +-
.../3.1.x/mini/validators-dates/zod.gen.ts | 32 +-
.../3.1.x/mini/validators-metadata/zod.gen.ts | 36 +-
.../3.1.x/mini/validators-types/zod.gen.ts | 40 +-
.../3.1.x/mini/validators/zod.gen.ts | 32 +-
.../__snapshots__/3.1.x/v3/default/zod.gen.ts | 272 ++--
.../v3/validators-circular-ref/zod.gen.ts | 10 +-
.../3.1.x/v3/validators-dates/zod.gen.ts | 28 +-
.../3.1.x/v3/validators-metadata/zod.gen.ts | 28 +-
.../3.1.x/v3/validators-types/zod.gen.ts | 36 +-
.../3.1.x/v3/validators/zod.gen.ts | 28 +-
.../__snapshots__/3.1.x/v4/default/zod.gen.ts | 274 ++--
.../v4/validators-circular-ref/zod.gen.ts | 12 +-
.../3.1.x/v4/validators-dates/zod.gen.ts | 32 +-
.../3.1.x/v4/validators-metadata/zod.gen.ts | 36 +-
.../3.1.x/v4/validators-types/zod.gen.ts | 40 +-
.../3.1.x/v4/validators/zod.gen.ts | 32 +-
.../openapi-ts-tests/zod/v4/vitest.config.ts | 14 +-
packages/openapi-ts/CHANGELOG.md | 18 +
packages/openapi-ts/package.json | 6 +-
.../src/__tests__/createClient.test.ts | 2 +-
.../openapi-ts/src/__tests__/error.test.ts | 2 +-
.../openapi-ts/src/__tests__/index.test.ts | 2 +-
.../src/__tests__/interactive.test.ts | 6 +-
.../src/config/__tests__/input.test.ts | 3 +-
packages/openapi-ts/src/config/engine.ts | 2 +-
packages/openapi-ts/src/config/init.ts | 11 +-
packages/openapi-ts/src/config/input.ts | 8 +-
packages/openapi-ts/src/config/logs.ts | 2 +-
packages/openapi-ts/src/config/merge.ts | 2 +-
packages/openapi-ts/src/config/output.ts | 5 +-
packages/openapi-ts/src/config/parser.ts | 3 +-
packages/openapi-ts/src/config/plugins.ts | 7 +-
packages/openapi-ts/src/createClient.ts | 37 +-
packages/openapi-ts/src/debug/graph.ts | 2 +-
packages/openapi-ts/src/debug/ir.ts | 4 +-
packages/openapi-ts/src/error.ts | 4 +-
.../src/generate/__tests__/class.test.ts | 11 +-
.../src/generate/__tests__/core.test.ts | 23 +-
.../src/generate/__tests__/mocks.ts | 8 +-
.../src/generate/__tests__/renderer.test.ts | 75 +
packages/openapi-ts/src/generate/class.ts | 15 +-
packages/openapi-ts/src/generate/client.ts | 9 +-
packages/openapi-ts/src/generate/core.ts | 10 +-
packages/openapi-ts/src/generate/file.ts | 5 +-
.../generate/legacy/__tests__/index.test.ts | 9 +-
.../generate/legacy/__tests__/output.test.ts | 13 +-
.../src/generate/legacy/indexFile.ts | 9 +-
.../openapi-ts/src/generate/legacy/output.ts | 13 +-
packages/openapi-ts/src/generate/output.ts | 5 +-
packages/openapi-ts/src/generate/renderer.ts | 18 +-
packages/openapi-ts/src/generate/tsConfig.ts | 2 +-
packages/openapi-ts/src/getSpec.ts | 6 +-
packages/openapi-ts/src/index.ts | 26 +-
.../openapi-ts/src/ir/__tests__/graph.test.ts | 327 ++++
.../src/ir/__tests__/pagination.test.ts | 5 +-
packages/openapi-ts/src/ir/context.ts | 26 +-
packages/openapi-ts/src/ir/graph.ts | 261 ++++
packages/openapi-ts/src/ir/pagination.ts | 3 +-
packages/openapi-ts/src/ir/types.d.ts | 13 +-
.../2.0.x/parser/__tests__/server.test.ts | 3 +-
.../2.0.x/parser/__tests__/validate.test.ts | 5 +-
.../src/openApi/2.0.x/parser/filter.ts | 9 +-
.../src/openApi/2.0.x/parser/index.ts | 17 +-
.../src/openApi/2.0.x/parser/mediaType.ts | 8 +-
.../src/openApi/2.0.x/parser/operation.ts | 7 +-
.../src/openApi/2.0.x/parser/pagination.ts | 7 +-
.../src/openApi/2.0.x/parser/parameter.ts | 4 +-
.../src/openApi/2.0.x/parser/schema.ts | 27 +-
.../src/openApi/2.0.x/parser/server.ts | 4 +-
.../src/openApi/2.0.x/parser/validate.ts | 9 +-
.../2.0.x/types/json-schema-draft-4.d.ts | 2 +-
.../src/openApi/2.0.x/types/spec.d.ts | 3 +-
.../3.0.x/parser/__tests__/validate.test.ts | 5 +-
.../src/openApi/3.0.x/parser/filter.ts | 9 +-
.../src/openApi/3.0.x/parser/index.ts | 17 +-
.../src/openApi/3.0.x/parser/mediaType.ts | 8 +-
.../src/openApi/3.0.x/parser/operation.ts | 7 +-
.../src/openApi/3.0.x/parser/pagination.ts | 7 +-
.../src/openApi/3.0.x/parser/parameter.ts | 6 +-
.../src/openApi/3.0.x/parser/requestBody.ts | 6 +-
.../src/openApi/3.0.x/parser/schema.ts | 27 +-
.../src/openApi/3.0.x/parser/server.ts | 4 +-
.../src/openApi/3.0.x/parser/validate.ts | 9 +-
.../src/openApi/3.0.x/types/spec.d.ts | 2 +-
.../3.1.x/parser/__tests__/validate.test.ts | 5 +-
.../src/openApi/3.1.x/parser/filter.ts | 9 +-
.../src/openApi/3.1.x/parser/index.ts | 17 +-
.../src/openApi/3.1.x/parser/mediaType.ts | 8 +-
.../src/openApi/3.1.x/parser/operation.ts | 9 +-
.../src/openApi/3.1.x/parser/pagination.ts | 7 +-
.../src/openApi/3.1.x/parser/parameter.ts | 6 +-
.../src/openApi/3.1.x/parser/requestBody.ts | 6 +-
.../src/openApi/3.1.x/parser/schema.ts | 27 +-
.../src/openApi/3.1.x/parser/server.ts | 4 +-
.../src/openApi/3.1.x/parser/validate.ts | 9 +-
.../src/openApi/3.1.x/parser/webhook.ts | 5 +-
.../types/json-schema-draft-2020-12.d.ts | 3 +-
.../src/openApi/__tests__/index.test.ts | 13 +-
.../src/openApi/common/interfaces/OpenApi.ts | 4 +-
.../src/openApi/common/interfaces/client.ts | 3 +-
.../common/parser/__tests__/type.test.ts | 2 +-
.../src/openApi/common/parser/getDefault.ts | 7 +-
.../src/openApi/common/parser/getEnums.ts | 3 +-
.../src/openApi/common/parser/getRef.ts | 5 +-
.../src/openApi/common/parser/operation.ts | 7 +-
.../src/openApi/common/parser/sanitize.ts | 2 +-
.../src/openApi/common/parser/type.ts | 7 +-
packages/openapi-ts/src/openApi/index.ts | 26 +-
.../src/openApi/shared/graph/meta.ts | 15 +-
.../src/openApi/shared/transforms/enums.ts | 3 +-
.../src/openApi/shared/transforms/index.ts | 3 +-
.../openApi/shared/transforms/readWrite.ts | 5 +-
.../src/openApi/shared/types/schema.d.ts | 13 -
.../shared/utils/__tests__/graph.test.ts | 104 ++
.../shared/utils/__tests__/patch.test.ts | 3 +-
.../src/openApi/shared/utils/discriminator.ts | 2 +-
.../src/openApi/shared/utils/filter.ts | 9 +-
.../src/openApi/shared/utils/graph.ts | 192 ++-
.../src/openApi/shared/utils/identifier.ts | 2 +-
.../src/openApi/shared/utils/name.ts | 3 +-
.../src/openApi/shared/utils/operation.ts | 9 +-
.../src/openApi/shared/utils/parameter.ts | 2 +-
.../src/openApi/shared/utils/patch.ts | 3 +-
.../src/openApi/shared/utils/validator.ts | 2 +-
packages/openapi-ts/src/openApi/types.d.ts | 6 +-
packages/openapi-ts/src/openApi/v2/index.ts | 5 +-
.../src/openApi/v2/interfaces/Model.ts | 3 +-
.../src/openApi/v2/interfaces/OpenApi.ts | 3 +-
.../openApi/v2/interfaces/OpenApiHeader.ts | 3 +-
.../src/openApi/v2/interfaces/OpenApiItems.ts | 2 +-
.../openApi/v2/interfaces/OpenApiParameter.ts | 3 +-
.../openApi/v2/interfaces/OpenApiResponse.ts | 3 +-
.../openApi/v2/interfaces/OpenApiSchema.ts | 5 +-
.../v2/interfaces/OpenApiSecurityScheme.ts | 2 +-
.../src/openApi/v2/parser/getModel.ts | 9 +-
.../openApi/v2/parser/getModelComposition.ts | 6 +-
.../openApi/v2/parser/getModelProperties.ts | 9 +-
.../src/openApi/v2/parser/getModels.ts | 5 +-
.../v2/parser/getOperationParameter.ts | 15 +-
.../v2/parser/getOperationParameters.ts | 7 +-
.../openApi/v2/parser/getOperationResponse.ts | 9 +-
.../v2/parser/getOperationResponses.ts | 9 +-
.../src/openApi/v2/parser/getOperations.ts | 11 +-
.../getRequiredPropertiesFromComposition.ts | 5 +-
.../src/openApi/v2/parser/operation.ts | 11 +-
packages/openapi-ts/src/openApi/v3/index.ts | 5 +-
.../src/openApi/v3/interfaces/Model.ts | 3 +-
.../v3/interfaces/OpenApiComponents.ts | 3 +-
.../v3/interfaces/OpenApiDiscriminator.ts | 2 +-
.../openApi/v3/interfaces/OpenApiEncoding.ts | 3 +-
.../openApi/v3/interfaces/OpenApiHeader.ts | 3 +-
.../src/openApi/v3/interfaces/OpenApiLink.ts | 3 +-
.../openApi/v3/interfaces/OpenApiMediaType.ts | 3 +-
.../openApi/v3/interfaces/OpenApiOAuthFlow.ts | 2 +-
.../openApi/v3/interfaces/OpenApiOperation.ts | 3 +-
.../openApi/v3/interfaces/OpenApiParameter.ts | 3 +-
.../v3/interfaces/OpenApiRequestBody.ts | 3 +-
.../openApi/v3/interfaces/OpenApiResponse.ts | 3 +-
.../openApi/v3/interfaces/OpenApiSchema.ts | 5 +-
.../openApi/v3/interfaces/OpenApiServer.ts | 3 +-
.../v3/interfaces/OpenApiServerVariable.ts | 2 +-
.../v3/parser/__tests__/getModel.test.ts | 5 +-
.../src/openApi/v3/parser/discriminator.ts | 7 +-
.../src/openApi/v3/parser/getContent.ts | 3 +-
.../src/openApi/v3/parser/getModel.ts | 13 +-
.../openApi/v3/parser/getModelComposition.ts | 6 +-
.../openApi/v3/parser/getModelProperties.ts | 13 +-
.../src/openApi/v3/parser/getModels.ts | 3 +-
.../v3/parser/getOperationParameter.ts | 17 +-
.../v3/parser/getOperationParameters.ts | 7 +-
.../v3/parser/getOperationRequestBody.ts | 7 +-
.../openApi/v3/parser/getOperationResponse.ts | 9 +-
.../v3/parser/getOperationResponses.ts | 9 +-
.../src/openApi/v3/parser/getOperations.ts | 11 +-
.../getRequiredPropertiesFromComposition.ts | 7 +-
.../src/openApi/v3/parser/operation.ts | 13 +-
.../src/plugins/@angular/common/api.ts | 6 +-
.../src/plugins/@angular/common/config.ts | 3 +-
.../plugins/@angular/common/httpRequests.ts | 191 +--
.../plugins/@angular/common/httpResources.ts | 187 +--
.../src/plugins/@angular/common/plugin.ts | 8 +-
.../src/plugins/@angular/common/types.d.ts | 5 +-
.../plugins/@hey-api/client-angular/api.ts | 6 +-
.../plugins/@hey-api/client-angular/config.ts | 10 +-
.../@hey-api/client-angular/types.d.ts | 5 +-
.../client-axios/__tests__/client.test.ts | 203 ---
.../src/plugins/@hey-api/client-axios/api.ts | 6 +-
.../@hey-api/client-axios/bundle/client.ts | 25 +-
.../plugins/@hey-api/client-axios/config.ts | 10 +-
.../plugins/@hey-api/client-axios/types.d.ts | 5 +-
.../plugins/@hey-api/client-core/client.ts | 11 +-
.../client-core/createClientConfig.ts | 7 +-
.../plugins/@hey-api/client-core/types.d.ts | 14 +-
.../src/plugins/@hey-api/client-core/utils.ts | 4 +-
.../src/plugins/@hey-api/client-fetch/api.ts | 6 +-
.../plugins/@hey-api/client-fetch/config.ts | 10 +-
.../plugins/@hey-api/client-fetch/types.d.ts | 5 +-
.../src/plugins/@hey-api/client-next/api.ts | 6 +-
.../plugins/@hey-api/client-next/config.ts | 10 +-
.../plugins/@hey-api/client-next/types.d.ts | 5 +-
.../src/plugins/@hey-api/client-nuxt/api.ts | 6 +-
.../plugins/@hey-api/client-nuxt/config.ts | 10 +-
.../plugins/@hey-api/client-nuxt/types.d.ts | 5 +-
.../src/plugins/@hey-api/client-ofetch/api.ts | 6 +-
.../plugins/@hey-api/client-ofetch/config.ts | 10 +-
.../plugins/@hey-api/client-ofetch/types.d.ts | 5 +-
.../plugins/@hey-api/legacy-angular/config.ts | 3 +-
.../@hey-api/legacy-angular/types.d.ts | 4 +-
.../plugins/@hey-api/legacy-axios/config.ts | 3 +-
.../plugins/@hey-api/legacy-axios/types.d.ts | 4 +-
.../plugins/@hey-api/legacy-fetch/config.ts | 3 +-
.../plugins/@hey-api/legacy-fetch/types.d.ts | 4 +-
.../plugins/@hey-api/legacy-node/config.ts | 3 +-
.../plugins/@hey-api/legacy-node/types.d.ts | 4 +-
.../src/plugins/@hey-api/legacy-xhr/config.ts | 3 +-
.../plugins/@hey-api/legacy-xhr/types.d.ts | 4 +-
.../schemas/__tests__/schemas.test.ts | 23 +-
.../src/plugins/@hey-api/schemas/api.ts | 6 +-
.../src/plugins/@hey-api/schemas/config.ts | 3 +-
.../plugins/@hey-api/schemas/plugin-legacy.ts | 11 +-
.../src/plugins/@hey-api/schemas/plugin.ts | 23 +-
.../src/plugins/@hey-api/schemas/types.d.ts | 11 +-
.../@hey-api/sdk/__tests__/plugin.test.ts | 39 +-
.../src/plugins/@hey-api/sdk/api.ts | 7 +-
.../src/plugins/@hey-api/sdk/auth.ts | 3 +-
.../src/plugins/@hey-api/sdk/comment.ts | 6 +-
.../src/plugins/@hey-api/sdk/config.ts | 3 +-
.../src/plugins/@hey-api/sdk/operation.ts | 45 +-
.../src/plugins/@hey-api/sdk/plugin-legacy.ts | 35 +-
.../src/plugins/@hey-api/sdk/plugin.ts | 439 +++---
.../src/plugins/@hey-api/sdk/signature.ts | 2 +-
.../src/plugins/@hey-api/sdk/typeOptions.ts | 13 +-
.../src/plugins/@hey-api/sdk/types.d.ts | 9 +-
.../src/plugins/@hey-api/sdk/validator.ts | 3 +-
.../src/plugins/@hey-api/transformers/api.ts | 6 +-
.../plugins/@hey-api/transformers/config.ts | 3 +-
.../@hey-api/transformers/expressions.ts | 5 +-
.../@hey-api/transformers/plugin-legacy.ts | 18 +-
.../plugins/@hey-api/transformers/plugin.ts | 138 +-
.../plugins/@hey-api/transformers/types.d.ts | 5 +-
.../typescript/__tests__/plugin.test.ts | 17 +-
.../src/plugins/@hey-api/typescript/api.ts | 9 +-
.../@hey-api/typescript/clientOptions.ts | 12 +-
.../src/plugins/@hey-api/typescript/config.ts | 3 +-
.../src/plugins/@hey-api/typescript/export.ts | 11 +-
.../plugins/@hey-api/typescript/operation.ts | 21 +-
.../@hey-api/typescript/plugin-legacy.ts | 34 +-
.../src/plugins/@hey-api/typescript/plugin.ts | 36 +-
.../plugins/@hey-api/typescript/types.d.ts | 5 +-
.../plugins/@hey-api/typescript/webhook.ts | 15 +-
.../plugins/@hey-api/typescript/webhooks.ts | 3 +-
.../src/plugins/@pinia/colada/api.ts | 6 +-
.../src/plugins/@pinia/colada/config.ts | 3 +-
.../src/plugins/@pinia/colada/meta.ts | 5 +-
.../plugins/@pinia/colada/mutationOptions.ts | 9 +-
.../src/plugins/@pinia/colada/plugin.ts | 97 +-
.../src/plugins/@pinia/colada/queryKey.ts | 33 +-
.../src/plugins/@pinia/colada/queryOptions.ts | 17 +-
.../src/plugins/@pinia/colada/types.d.ts | 7 +-
.../src/plugins/@pinia/colada/useType.ts | 13 +-
.../src/plugins/@pinia/colada/utils.ts | 3 +-
.../angular-query-experimental/api.ts | 6 +-
.../angular-query-experimental/config.ts | 7 +-
.../angular-query-experimental/types.d.ts | 7 +-
.../query-core/infiniteQueryOptions.ts | 27 +-
.../src/plugins/@tanstack/query-core/meta.ts | 5 +-
.../@tanstack/query-core/mutationOptions.ts | 9 +-
.../@tanstack/query-core/plugin-legacy.ts | 54 +-
.../plugins/@tanstack/query-core/plugin.ts | 115 +-
.../plugins/@tanstack/query-core/queryKey.ts | 27 +-
.../@tanstack/query-core/queryOptions.ts | 15 +-
.../plugins/@tanstack/query-core/types.d.ts | 10 +-
.../plugins/@tanstack/query-core/useQuery.ts | 13 +-
.../plugins/@tanstack/query-core/useType.ts | 17 +-
.../src/plugins/@tanstack/react-query/api.ts | 6 +-
.../plugins/@tanstack/react-query/config.ts | 7 +-
.../plugins/@tanstack/react-query/types.d.ts | 7 +-
.../src/plugins/@tanstack/solid-query/api.ts | 6 +-
.../plugins/@tanstack/solid-query/config.ts | 7 +-
.../plugins/@tanstack/solid-query/types.d.ts | 7 +-
.../src/plugins/@tanstack/svelte-query/api.ts | 6 +-
.../plugins/@tanstack/svelte-query/config.ts | 7 +-
.../plugins/@tanstack/svelte-query/types.d.ts | 7 +-
.../src/plugins/@tanstack/vue-query/api.ts | 6 +-
.../src/plugins/@tanstack/vue-query/config.ts | 7 +-
.../plugins/@tanstack/vue-query/types.d.ts | 7 +-
.../openapi-ts/src/plugins/arktype/api.ts | 56 +
.../openapi-ts/src/plugins/arktype/config.ts | 272 ++++
.../src/plugins/arktype/constants.ts | 115 ++
.../openapi-ts/src/plugins/arktype/index.ts | 2 +
.../openapi-ts/src/plugins/arktype/plugin.ts | 4 +
.../src/plugins/arktype/shared/export.ts | 63 +
.../src/plugins/arktype/shared/types.d.ts | 31 +
.../openapi-ts/src/plugins/arktype/types.d.ts | 666 ++++++++
.../openapi-ts/src/plugins/arktype/v2/api.ts | 88 ++
.../src/plugins/arktype/v2/plugin.ts | 364 +++++
.../src/plugins/arktype/v2/toAst/index.ts | 124 ++
.../src/plugins/arktype/v2/toAst/null.ts | 15 +
.../src/plugins/arktype/v2/toAst/object.ts | 172 +++
.../src/plugins/arktype/v2/toAst/string.ts | 66 +
packages/openapi-ts/src/plugins/config.ts | 106 +-
.../openapi-ts/src/plugins/fastify/api.ts | 6 +-
.../openapi-ts/src/plugins/fastify/config.ts | 3 +-
.../openapi-ts/src/plugins/fastify/plugin.ts | 37 +-
.../openapi-ts/src/plugins/fastify/types.d.ts | 3 +-
.../src/plugins/shared/types/instance.d.ts | 37 +-
.../src/plugins/shared/types/refs.d.ts | 59 +
.../src/plugins/shared/types/schema.d.ts | 8 +
.../shared/utils/__tests__/refs.test.ts | 85 +
.../src/plugins/shared/utils/case.ts | 6 +-
.../src/plugins/shared/utils/config.ts | 2 +-
.../src/plugins/shared/utils/instance.ts | 310 ++--
.../src/plugins/shared/utils/operation.ts | 6 +-
.../src/plugins/shared/utils/refs.ts | 66 +
.../src/plugins/shared/utils/schema.ts | 6 +-
packages/openapi-ts/src/plugins/types.d.ts | 16 +-
.../openapi-ts/src/plugins/valibot/api.ts | 107 +-
.../openapi-ts/src/plugins/valibot/config.ts | 3 +-
.../openapi-ts/src/plugins/valibot/plugin.ts | 1375 +----------------
.../{number-helpers.ts => shared/numbers.ts} | 3 +-
.../src/plugins/valibot/shared/types.d.ts | 25 +
.../openapi-ts/src/plugins/valibot/types.d.ts | 5 +-
.../openapi-ts/src/plugins/valibot/v1/api.ts | 86 ++
.../src/plugins/valibot/{ => v1}/constants.ts | 2 +-
.../src/plugins/valibot/{ => v1}/operation.ts | 43 +-
.../src/plugins/valibot/v1/pipesToAst.ts | 30 +
.../src/plugins/valibot/v1/plugin.ts | 315 ++++
.../src/plugins/valibot/v1/toAst/array.ts | 128 ++
.../src/plugins/valibot/v1/toAst/boolean.ts | 35 +
.../src/plugins/valibot/v1/toAst/enum.ts | 72 +
.../src/plugins/valibot/v1/toAst/index.ts | 122 ++
.../src/plugins/valibot/v1/toAst/never.ts | 22 +
.../src/plugins/valibot/v1/toAst/null.ts | 22 +
.../src/plugins/valibot/v1/toAst/number.ts | 255 +++
.../src/plugins/valibot/v1/toAst/object.ts | 120 ++
.../src/plugins/valibot/v1/toAst/string.ts | 144 ++
.../src/plugins/valibot/v1/toAst/tuple.ts | 79 +
.../src/plugins/valibot/v1/toAst/undefined.ts | 23 +
.../src/plugins/valibot/v1/toAst/unknown.ts | 23 +
.../src/plugins/valibot/v1/toAst/void.ts | 23 +
.../src/plugins/valibot/{ => v1}/webhook.ts | 28 +-
packages/openapi-ts/src/plugins/zod/api.ts | 113 +-
packages/openapi-ts/src/plugins/zod/config.ts | 3 +-
.../openapi-ts/src/plugins/zod/constants.ts | 3 +-
.../openapi-ts/src/plugins/zod/mini/api.ts | 72 +
.../openapi-ts/src/plugins/zod/mini/plugin.ts | 1301 ++--------------
.../src/plugins/zod/mini/toAst/array.ts | 174 +++
.../src/plugins/zod/mini/toAst/boolean.ts | 35 +
.../src/plugins/zod/mini/toAst/enum.ts | 128 ++
.../src/plugins/zod/mini/toAst/index.ts | 86 ++
.../src/plugins/zod/mini/toAst/never.ts | 21 +
.../src/plugins/zod/mini/toAst/null.ts | 21 +
.../src/plugins/zod/mini/toAst/number.ts | 119 ++
.../src/plugins/zod/mini/toAst/object.ts | 130 ++
.../src/plugins/zod/mini/toAst/string.ts | 193 +++
.../src/plugins/zod/mini/toAst/tuple.ts | 78 +
.../src/plugins/zod/mini/toAst/undefined.ts | 21 +
.../src/plugins/zod/mini/toAst/unknown.ts | 21 +
.../src/plugins/zod/mini/toAst/void.ts | 21 +
packages/openapi-ts/src/plugins/zod/plugin.ts | 3 +-
.../src/plugins/zod/{ => shared}/export.ts | 35 +-
.../src/plugins/zod/shared/numbers.ts | 28 +
.../src/plugins/zod/shared/operation.ts | 63 +-
.../src/plugins/zod/shared/types.d.ts | 37 +-
.../src/plugins/zod/shared/webhook.ts | 43 +-
.../openapi-ts/src/plugins/zod/types.d.ts | 25 +-
packages/openapi-ts/src/plugins/zod/v3/api.ts | 72 +
.../openapi-ts/src/plugins/zod/v3/plugin.ts | 1198 ++------------
.../src/plugins/zod/v3/toAst/array.ts | 162 ++
.../src/plugins/zod/v3/toAst/boolean.ts | 33 +
.../src/plugins/zod/v3/toAst/enum.ts | 126 ++
.../src/plugins/zod/v3/toAst/index.ts | 106 ++
.../src/plugins/zod/v3/toAst/never.ts | 20 +
.../src/plugins/zod/v3/toAst/null.ts | 20 +
.../src/plugins/zod/v3/toAst/number.ts | 95 ++
.../src/plugins/zod/v3/toAst/object.ts | 113 ++
.../src/plugins/zod/v3/toAst/string.ts | 153 ++
.../src/plugins/zod/v3/toAst/tuple.ts | 85 +
.../src/plugins/zod/v3/toAst/undefined.ts | 20 +
.../src/plugins/zod/v3/toAst/unknown.ts | 20 +
.../src/plugins/zod/v3/toAst/void.ts | 20 +
packages/openapi-ts/src/plugins/zod/v4/api.ts | 72 +
.../openapi-ts/src/plugins/zod/v4/plugin.ts | 1258 ++-------------
.../src/plugins/zod/v4/toAst/array.ts | 156 ++
.../src/plugins/zod/v4/toAst/boolean.ts | 35 +
.../src/plugins/zod/v4/toAst/enum.ts | 128 ++
.../src/plugins/zod/v4/toAst/index.ts | 86 ++
.../src/plugins/zod/v4/toAst/never.ts | 21 +
.../src/plugins/zod/v4/toAst/null.ts | 21 +
.../src/plugins/zod/v4/toAst/number.ts | 97 ++
.../src/plugins/zod/v4/toAst/object.ts | 147 ++
.../src/plugins/zod/v4/toAst/string.ts | 171 ++
.../src/plugins/zod/v4/toAst/tuple.ts | 78 +
.../src/plugins/zod/v4/toAst/undefined.ts | 21 +
.../src/plugins/zod/v4/toAst/unknown.ts | 21 +
.../src/plugins/zod/v4/toAst/void.ts | 21 +
packages/openapi-ts/src/processOutput.ts | 4 +-
packages/openapi-ts/src/tsc/transform.ts | 3 +-
packages/openapi-ts/src/tsc/typedef.ts | 3 +-
packages/openapi-ts/src/tsc/types.ts | 5 +-
packages/openapi-ts/src/tsc/utils.ts | 5 +-
packages/openapi-ts/src/types/client.d.ts | 2 +-
packages/openapi-ts/src/types/config.d.ts | 5 +-
packages/openapi-ts/src/types/parser.d.ts | 5 +-
packages/openapi-ts/src/types/utils.d.ts | 2 +-
.../src/utils/__tests__/handlebars.test.ts | 12 +-
.../src/utils/__tests__/minHeap.test.ts | 59 +
.../src/utils/__tests__/parse.test.ts | 17 +-
.../src/utils/__tests__/postprocess.test.ts | 5 +-
.../src/utils/__tests__/sort.test.ts | 3 +-
.../src/utils/__tests__/stringCase.test.ts | 3 +-
.../src/utils/__tests__/type.test.ts | 3 +-
packages/openapi-ts/src/utils/cli.ts | 2 +-
packages/openapi-ts/src/utils/config.ts | 4 +-
packages/openapi-ts/src/utils/enum.ts | 5 +-
packages/openapi-ts/src/utils/escape.ts | 2 +-
.../src/utils/getHttpRequestName.ts | 2 +-
packages/openapi-ts/src/utils/handlebars.ts | 89 +-
packages/openapi-ts/src/utils/input/heyApi.ts | 2 +-
packages/openapi-ts/src/utils/input/index.ts | 3 +-
packages/openapi-ts/src/utils/input/readme.ts | 2 +-
packages/openapi-ts/src/utils/input/scalar.ts | 2 +-
packages/openapi-ts/src/utils/meta.ts | 3 +-
packages/openapi-ts/src/utils/minHeap.ts | 64 +
packages/openapi-ts/src/utils/postprocess.ts | 9 +-
packages/openapi-ts/src/utils/stringCase.ts | 2 +-
packages/openapi-ts/src/utils/transform.ts | 5 +-
packages/openapi-ts/src/utils/type.ts | 9 +-
packages/openapi-ts/tsconfig.base.json | 6 +-
packages/openapi-ts/vitest.config.ts | 21 +-
pnpm-lock.yaml | 643 +++-----
scripts/example.sh | 3 -
scripts/examples-check.sh | 37 +
scripts/examples-generate.sh | 90 ++
748 files changed, 28333 insertions(+), 17288 deletions(-)
create mode 100644 eslint-rules/local-paths.js
create mode 100644 examples/README.md
rename examples/openapi-ts-angular-common/src/client/@angular/{common/http/resources.gen.ts => common.gen.ts} (53%)
delete mode 100644 examples/openapi-ts-angular-common/src/client/@angular/common/http/requests.gen.ts
create mode 100644 examples/openapi-ts-angular-common/src/client/core/queryKeySerializer.gen.ts
create mode 100644 examples/openapi-ts-angular/src/client/core/queryKeySerializer.gen.ts
create mode 100644 examples/openapi-ts-axios/src/client/core/queryKeySerializer.gen.ts
create mode 100644 examples/openapi-ts-axios/src/client/core/serverSentEvents.gen.ts
create mode 100644 examples/openapi-ts-axios/src/client/core/utils.gen.ts
rename examples/{openapi-ts-sample/src/client/client/client.ts => openapi-ts-fastify/src/client/client/client.gen.ts} (56%)
delete mode 100644 examples/openapi-ts-fastify/src/client/client/client.ts
rename examples/{openapi-ts-fetch/src/client/client/types.ts => openapi-ts-fastify/src/client/client/types.gen.ts} (70%)
rename examples/{openapi-ts-sample/src/client/client/utils.ts => openapi-ts-fastify/src/client/client/utils.gen.ts} (59%)
rename examples/openapi-ts-fastify/src/client/core/{auth.ts => auth.gen.ts} (93%)
rename examples/{openapi-ts-sample/src/client/core/bodySerializer.ts => openapi-ts-fastify/src/client/core/bodySerializer.gen.ts} (92%)
rename examples/{openapi-ts-sample/src/client/core/params.ts => openapi-ts-fastify/src/client/core/params.gen.ts} (98%)
rename examples/{openapi-ts-next/src/client/core/pathSerializer.ts => openapi-ts-fastify/src/client/core/pathSerializer.gen.ts} (98%)
create mode 100644 examples/openapi-ts-fastify/src/client/core/queryKeySerializer.gen.ts
create mode 100644 examples/openapi-ts-fastify/src/client/core/serverSentEvents.gen.ts
rename examples/{openapi-ts-sample/src/client/core/types.ts => openapi-ts-fastify/src/client/core/types.gen.ts} (85%)
create mode 100644 examples/openapi-ts-fastify/src/client/core/utils.gen.ts
rename examples/openapi-ts-fetch/src/client/client/{client.ts => client.gen.ts} (54%)
rename examples/{openapi-ts-sample/src/client/client/types.ts => openapi-ts-fetch/src/client/client/types.gen.ts} (70%)
rename examples/openapi-ts-fetch/src/client/client/{utils.ts => utils.gen.ts} (59%)
rename examples/openapi-ts-fetch/src/client/core/{auth.ts => auth.gen.ts} (93%)
rename examples/openapi-ts-fetch/src/client/core/{bodySerializer.ts => bodySerializer.gen.ts} (84%)
rename examples/openapi-ts-fetch/src/client/core/{params.ts => params.gen.ts} (89%)
rename examples/{openapi-ts-sample/src/client/core/pathSerializer.ts => openapi-ts-fetch/src/client/core/pathSerializer.gen.ts} (98%)
create mode 100644 examples/openapi-ts-fetch/src/client/core/queryKeySerializer.gen.ts
create mode 100644 examples/openapi-ts-fetch/src/client/core/serverSentEvents.gen.ts
rename examples/openapi-ts-fetch/src/client/core/{types.ts => types.gen.ts} (75%)
create mode 100644 examples/openapi-ts-fetch/src/client/core/utils.gen.ts
create mode 100644 examples/openapi-ts-next/src/client/client/client.gen.ts
delete mode 100644 examples/openapi-ts-next/src/client/client/client.ts
rename examples/openapi-ts-next/src/client/client/{types.ts => types.gen.ts} (64%)
rename examples/openapi-ts-next/src/client/client/{utils.ts => utils.gen.ts} (81%)
rename examples/openapi-ts-next/src/client/core/{auth.ts => auth.gen.ts} (93%)
rename examples/{openapi-ts-fastify/src/client/core/bodySerializer.ts => openapi-ts-next/src/client/core/bodySerializer.gen.ts} (82%)
rename examples/{openapi-ts-fastify/src/client/core/params.ts => openapi-ts-next/src/client/core/params.gen.ts} (89%)
rename examples/{openapi-ts-fetch/src/client/core/pathSerializer.ts => openapi-ts-next/src/client/core/pathSerializer.gen.ts} (98%)
create mode 100644 examples/openapi-ts-next/src/client/core/queryKeySerializer.gen.ts
create mode 100644 examples/openapi-ts-next/src/client/core/serverSentEvents.gen.ts
rename examples/{openapi-ts-fastify/src/client/core/types.ts => openapi-ts-next/src/client/core/types.gen.ts} (68%)
create mode 100644 examples/openapi-ts-next/src/client/core/utils.gen.ts
create mode 100644 examples/openapi-ts-ofetch/src/client/core/queryKeySerializer.gen.ts
create mode 100644 examples/openapi-ts-openai/src/client/core/queryKeySerializer.gen.ts
create mode 100644 examples/openapi-ts-openai/src/client/core/serverSentEvents.gen.ts
create mode 100644 examples/openapi-ts-openai/src/client/core/utils.gen.ts
create mode 100644 examples/openapi-ts-sample/src/client/client/client.gen.ts
rename examples/{openapi-ts-tanstack-react-query/src/client/client/types.ts => openapi-ts-sample/src/client/client/types.gen.ts} (69%)
rename examples/{openapi-ts-tanstack-react-query/src/client/client/utils.ts => openapi-ts-sample/src/client/client/utils.gen.ts} (59%)
rename examples/openapi-ts-sample/src/client/core/{auth.ts => auth.gen.ts} (93%)
rename examples/{openapi-ts-next/src/client/core/bodySerializer.ts => openapi-ts-sample/src/client/core/bodySerializer.gen.ts} (82%)
rename examples/{openapi-ts-next/src/client/core/params.ts => openapi-ts-sample/src/client/core/params.gen.ts} (89%)
rename examples/{openapi-ts-fastify/src/client/core/pathSerializer.ts => openapi-ts-sample/src/client/core/pathSerializer.gen.ts} (98%)
create mode 100644 examples/openapi-ts-sample/src/client/core/queryKeySerializer.gen.ts
create mode 100644 examples/openapi-ts-sample/src/client/core/serverSentEvents.gen.ts
rename examples/{openapi-ts-next/src/client/core/types.ts => openapi-ts-sample/src/client/core/types.gen.ts} (68%)
create mode 100644 examples/openapi-ts-sample/src/client/core/utils.gen.ts
create mode 100644 examples/openapi-ts-tanstack-angular-query-experimental/src/client/core/queryKeySerializer.gen.ts
create mode 100644 examples/openapi-ts-tanstack-angular-query-experimental/src/client/core/serverSentEvents.gen.ts
create mode 100644 examples/openapi-ts-tanstack-angular-query-experimental/src/client/core/utils.gen.ts
create mode 100644 examples/openapi-ts-tanstack-react-query/src/client/client/client.gen.ts
delete mode 100644 examples/openapi-ts-tanstack-react-query/src/client/client/client.ts
rename examples/{openapi-ts-fastify/src/client/client/types.ts => openapi-ts-tanstack-react-query/src/client/client/types.gen.ts} (69%)
rename examples/{openapi-ts-fastify/src/client/client/utils.ts => openapi-ts-tanstack-react-query/src/client/client/utils.gen.ts} (59%)
create mode 100644 examples/openapi-ts-tanstack-react-query/src/client/core/auth.gen.ts
delete mode 100644 examples/openapi-ts-tanstack-react-query/src/client/core/auth.ts
create mode 100644 examples/openapi-ts-tanstack-react-query/src/client/core/bodySerializer.gen.ts
delete mode 100644 examples/openapi-ts-tanstack-react-query/src/client/core/bodySerializer.ts
create mode 100644 examples/openapi-ts-tanstack-react-query/src/client/core/params.gen.ts
delete mode 100644 examples/openapi-ts-tanstack-react-query/src/client/core/params.ts
create mode 100644 examples/openapi-ts-tanstack-react-query/src/client/core/pathSerializer.gen.ts
delete mode 100644 examples/openapi-ts-tanstack-react-query/src/client/core/pathSerializer.ts
create mode 100644 examples/openapi-ts-tanstack-react-query/src/client/core/queryKeySerializer.gen.ts
create mode 100644 examples/openapi-ts-tanstack-react-query/src/client/core/serverSentEvents.gen.ts
create mode 100644 examples/openapi-ts-tanstack-react-query/src/client/core/types.gen.ts
delete mode 100644 examples/openapi-ts-tanstack-react-query/src/client/core/types.ts
create mode 100644 examples/openapi-ts-tanstack-react-query/src/client/core/utils.gen.ts
create mode 100644 examples/openapi-ts-tanstack-svelte-query/src/client/client/client.gen.ts
delete mode 100644 examples/openapi-ts-tanstack-svelte-query/src/client/client/client.ts
create mode 100644 examples/openapi-ts-tanstack-svelte-query/src/client/client/types.gen.ts
delete mode 100644 examples/openapi-ts-tanstack-svelte-query/src/client/client/types.ts
create mode 100644 examples/openapi-ts-tanstack-svelte-query/src/client/client/utils.gen.ts
delete mode 100644 examples/openapi-ts-tanstack-svelte-query/src/client/client/utils.ts
create mode 100644 examples/openapi-ts-tanstack-svelte-query/src/client/core/auth.gen.ts
delete mode 100644 examples/openapi-ts-tanstack-svelte-query/src/client/core/auth.ts
create mode 100644 examples/openapi-ts-tanstack-svelte-query/src/client/core/bodySerializer.gen.ts
delete mode 100644 examples/openapi-ts-tanstack-svelte-query/src/client/core/bodySerializer.ts
create mode 100644 examples/openapi-ts-tanstack-svelte-query/src/client/core/params.gen.ts
delete mode 100644 examples/openapi-ts-tanstack-svelte-query/src/client/core/params.ts
create mode 100644 examples/openapi-ts-tanstack-svelte-query/src/client/core/pathSerializer.gen.ts
delete mode 100644 examples/openapi-ts-tanstack-svelte-query/src/client/core/pathSerializer.ts
create mode 100644 examples/openapi-ts-tanstack-svelte-query/src/client/core/queryKeySerializer.gen.ts
create mode 100644 examples/openapi-ts-tanstack-svelte-query/src/client/core/serverSentEvents.gen.ts
create mode 100644 examples/openapi-ts-tanstack-svelte-query/src/client/core/types.gen.ts
delete mode 100644 examples/openapi-ts-tanstack-svelte-query/src/client/core/types.ts
create mode 100644 examples/openapi-ts-tanstack-svelte-query/src/client/core/utils.gen.ts
create mode 100644 examples/openapi-ts-tanstack-vue-query/src/client/client/client.gen.ts
delete mode 100644 examples/openapi-ts-tanstack-vue-query/src/client/client/client.ts
rename examples/openapi-ts-tanstack-vue-query/src/client/client/{types.ts => types.gen.ts} (68%)
rename examples/openapi-ts-tanstack-vue-query/src/client/client/{utils.ts => utils.gen.ts} (60%)
rename examples/openapi-ts-tanstack-vue-query/src/client/core/{auth.ts => auth.gen.ts} (93%)
rename examples/openapi-ts-tanstack-vue-query/src/client/core/{bodySerializer.ts => bodySerializer.gen.ts} (79%)
rename examples/openapi-ts-tanstack-vue-query/src/client/core/{params.ts => params.gen.ts} (89%)
rename examples/openapi-ts-tanstack-vue-query/src/client/core/{pathSerializer.ts => pathSerializer.gen.ts} (98%)
create mode 100644 examples/openapi-ts-tanstack-vue-query/src/client/core/queryKeySerializer.gen.ts
create mode 100644 examples/openapi-ts-tanstack-vue-query/src/client/core/serverSentEvents.gen.ts
rename examples/openapi-ts-tanstack-vue-query/src/client/core/{types.ts => types.gen.ts} (65%)
create mode 100644 examples/openapi-ts-tanstack-vue-query/src/client/core/utils.gen.ts
create mode 100644 packages/openapi-ts/src/ir/__tests__/graph.test.ts
create mode 100644 packages/openapi-ts/src/ir/graph.ts
create mode 100644 packages/openapi-ts/src/openApi/shared/utils/__tests__/graph.test.ts
create mode 100644 packages/openapi-ts/src/plugins/arktype/api.ts
create mode 100644 packages/openapi-ts/src/plugins/arktype/config.ts
create mode 100644 packages/openapi-ts/src/plugins/arktype/constants.ts
create mode 100644 packages/openapi-ts/src/plugins/arktype/index.ts
create mode 100644 packages/openapi-ts/src/plugins/arktype/plugin.ts
create mode 100644 packages/openapi-ts/src/plugins/arktype/shared/export.ts
create mode 100644 packages/openapi-ts/src/plugins/arktype/shared/types.d.ts
create mode 100644 packages/openapi-ts/src/plugins/arktype/types.d.ts
create mode 100644 packages/openapi-ts/src/plugins/arktype/v2/api.ts
create mode 100644 packages/openapi-ts/src/plugins/arktype/v2/plugin.ts
create mode 100644 packages/openapi-ts/src/plugins/arktype/v2/toAst/index.ts
create mode 100644 packages/openapi-ts/src/plugins/arktype/v2/toAst/null.ts
create mode 100644 packages/openapi-ts/src/plugins/arktype/v2/toAst/object.ts
create mode 100644 packages/openapi-ts/src/plugins/arktype/v2/toAst/string.ts
create mode 100644 packages/openapi-ts/src/plugins/shared/types/refs.d.ts
create mode 100644 packages/openapi-ts/src/plugins/shared/types/schema.d.ts
create mode 100644 packages/openapi-ts/src/plugins/shared/utils/__tests__/refs.test.ts
create mode 100644 packages/openapi-ts/src/plugins/shared/utils/refs.ts
rename packages/openapi-ts/src/plugins/valibot/{number-helpers.ts => shared/numbers.ts} (97%)
create mode 100644 packages/openapi-ts/src/plugins/valibot/shared/types.d.ts
create mode 100644 packages/openapi-ts/src/plugins/valibot/v1/api.ts
rename packages/openapi-ts/src/plugins/valibot/{ => v1}/constants.ts (99%)
rename packages/openapi-ts/src/plugins/valibot/{ => v1}/operation.ts (81%)
create mode 100644 packages/openapi-ts/src/plugins/valibot/v1/pipesToAst.ts
create mode 100644 packages/openapi-ts/src/plugins/valibot/v1/plugin.ts
create mode 100644 packages/openapi-ts/src/plugins/valibot/v1/toAst/array.ts
create mode 100644 packages/openapi-ts/src/plugins/valibot/v1/toAst/boolean.ts
create mode 100644 packages/openapi-ts/src/plugins/valibot/v1/toAst/enum.ts
create mode 100644 packages/openapi-ts/src/plugins/valibot/v1/toAst/index.ts
create mode 100644 packages/openapi-ts/src/plugins/valibot/v1/toAst/never.ts
create mode 100644 packages/openapi-ts/src/plugins/valibot/v1/toAst/null.ts
create mode 100644 packages/openapi-ts/src/plugins/valibot/v1/toAst/number.ts
create mode 100644 packages/openapi-ts/src/plugins/valibot/v1/toAst/object.ts
create mode 100644 packages/openapi-ts/src/plugins/valibot/v1/toAst/string.ts
create mode 100644 packages/openapi-ts/src/plugins/valibot/v1/toAst/tuple.ts
create mode 100644 packages/openapi-ts/src/plugins/valibot/v1/toAst/undefined.ts
create mode 100644 packages/openapi-ts/src/plugins/valibot/v1/toAst/unknown.ts
create mode 100644 packages/openapi-ts/src/plugins/valibot/v1/toAst/void.ts
rename packages/openapi-ts/src/plugins/valibot/{ => v1}/webhook.ts (83%)
create mode 100644 packages/openapi-ts/src/plugins/zod/mini/api.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/mini/toAst/array.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/mini/toAst/boolean.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/mini/toAst/enum.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/mini/toAst/index.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/mini/toAst/never.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/mini/toAst/null.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/mini/toAst/number.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/mini/toAst/object.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/mini/toAst/string.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/mini/toAst/tuple.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/mini/toAst/undefined.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/mini/toAst/unknown.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/mini/toAst/void.ts
rename packages/openapi-ts/src/plugins/zod/{ => shared}/export.ts (64%)
create mode 100644 packages/openapi-ts/src/plugins/zod/shared/numbers.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/v3/api.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/v3/toAst/array.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/v3/toAst/boolean.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/v3/toAst/enum.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/v3/toAst/index.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/v3/toAst/never.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/v3/toAst/null.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/v3/toAst/number.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/v3/toAst/object.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/v3/toAst/string.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/v3/toAst/tuple.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/v3/toAst/undefined.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/v3/toAst/unknown.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/v3/toAst/void.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/v4/api.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/v4/toAst/array.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/v4/toAst/boolean.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/v4/toAst/enum.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/v4/toAst/index.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/v4/toAst/never.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/v4/toAst/null.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/v4/toAst/number.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/v4/toAst/object.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/v4/toAst/string.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/v4/toAst/tuple.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/v4/toAst/undefined.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/v4/toAst/unknown.ts
create mode 100644 packages/openapi-ts/src/plugins/zod/v4/toAst/void.ts
create mode 100644 packages/openapi-ts/src/utils/__tests__/minHeap.test.ts
create mode 100644 packages/openapi-ts/src/utils/minHeap.ts
delete mode 100644 scripts/example.sh
create mode 100755 scripts/examples-check.sh
create mode 100755 scripts/examples-generate.sh
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index c50f87ce3..20d66513b 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -41,6 +41,10 @@ jobs:
if: matrix.node-version == '24.10.0' && matrix.os == 'ubuntu-latest'
run: pnpm build --filter="@example/**"
+ - name: Check examples generated code
+ if: matrix.node-version == '24.10.0' && matrix.os == 'ubuntu-latest'
+ run: pnpm examples:check
+
- name: Run linter
run: pnpm lint
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 6df8dbfe3..c4595f000 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -3,11 +3,12 @@
"source.fixAll.eslint": "explicit"
},
"editor.quickSuggestions": {
- "strings": true
+ "strings": "on"
},
"eslint.format.enable": true,
"eslint.nodePath": "./node_modules",
"eslint.workingDirectories": [{ "pattern": "./packages/*/" }],
"typescript.preferences.autoImportFileExcludePatterns": ["dist/**"],
+ "typescript.preferences.autoImportSpecifierExcludeRegexes": ["^(node:)?os$"],
"typescript.tsdk": "node_modules/typescript/lib"
}
diff --git a/docs/openapi-ts/community/contributing/developing.md b/docs/openapi-ts/community/contributing/developing.md
index 8b1aa38c3..2f7445d83 100644
--- a/docs/openapi-ts/community/contributing/developing.md
+++ b/docs/openapi-ts/community/contributing/developing.md
@@ -8,3 +8,49 @@ description: Learn how to contribute to Hey API.
::: warning
This page is under construction. We appreciate your patience.
:::
+
+## Working with Examples
+
+The `examples` folder contains various integration examples that demonstrate how to use `@hey-api/openapi-ts` with different frameworks and libraries. These examples are kept in sync with the codebase through automated checks.
+
+### Generating Example Code
+
+When you make changes to the core packages that affect code generation, you need to regenerate the client code in all examples:
+
+```bash
+pnpm examples:generate
+```
+
+This command will:
+
+- Find all examples with an `openapi-ts` script
+- Run the OpenAPI code generator for each example
+- Update the generated client code in each example
+
+### Checking Example Code
+
+Before committing changes, ensure that all generated example code is up-to-date:
+
+```bash
+pnpm examples:check
+```
+
+This command will:
+
+- Regenerate all example code
+- Check if any files were modified
+- Exit with an error if generated code is out of sync
+
+This check is also run automatically in CI to ensure examples stay in sync with the main codebase.
+
+### Example Workflow
+
+1. Make changes to core packages
+2. Build the packages: `pnpm build --filter="@hey-api/**"`
+3. Regenerate examples: `pnpm examples:generate`
+4. Commit all changes including the updated generated code
+5. The CI will verify that examples are in sync
+
+::: tip
+Think of generated example code as snapshot tests - they should always reflect the current state of the code generator.
+:::
diff --git a/docs/partials/contributors-list.md b/docs/partials/contributors-list.md
index bf465d047..b7aa7ab8f 100644
--- a/docs/partials/contributors-list.md
+++ b/docs/partials/contributors-list.md
@@ -51,6 +51,7 @@
- [Marcel Richter](https://github.com/mrclrchtr)
- [Marek Lukáš](https://github.com/tajnymag)
- [Matsu](https://github.com/Matsuuu)
+- [Maurici Abad Gutierrez](https://github.com/mauriciabad)
- [Max Scopp](https://github.com/max-scopp)
- [Maximilian Dewald](https://github.com/maxdewald)
- [Michał Grezel](https://github.com/dracomithril)
diff --git a/eslint-rules/local-paths.js b/eslint-rules/local-paths.js
new file mode 100644
index 000000000..10fedd255
--- /dev/null
+++ b/eslint-rules/local-paths.js
@@ -0,0 +1,233 @@
+import path from 'node:path';
+
+function normalize(p) {
+ return p.split(path.sep).join('/');
+}
+
+function stripExtAndIndex(p) {
+ return p
+ .replace(/(\/index)?\.(ts|tsx|js|cjs|mjs|d\.ts)$/, '')
+ .replace(/\/index$/, '');
+}
+
+/**
+ * Single consolidated rule implementing the previous three behaviors:
+ * - plugins: allow relative within same plugin (plugin may be @scope/name), else require `~`
+ * - openApi: allow relative only within same first-level openApi folder, else require `~`
+ * - first-level folders: allow relative only within same first-level folder, else require `~`
+ */
+const enforceLocalPaths = {
+ create(context) {
+ const filename = context.getFilename();
+ if (!filename || filename === '') return {};
+
+ const normalizedFile = normalize(filename);
+ const srcMarker = '/packages/openapi-ts/src/';
+ const srcIdx = normalizedFile.indexOf(srcMarker);
+ if (srcIdx === -1) return {};
+
+ const after = normalizedFile.slice(srcIdx + srcMarker.length);
+ const parts = after.split('/');
+ const firstLevel = parts[0];
+
+ // helpers and mode-specific roots
+ // compute the absolute normalized bundle root for accurate comparisons
+ let bundleAbsRoot =
+ normalizedFile.slice(0, srcIdx + srcMarker.length) +
+ 'plugins/@hey-api/client-core/bundle/';
+ bundleAbsRoot = normalize(bundleAbsRoot);
+
+ let mode = 'first-level';
+ let pluginAbsRoot = null;
+ let openApiFirstRoot = null;
+ let firstRoot = null;
+
+ if (firstLevel === 'plugins') {
+ mode = 'plugins';
+ // derive plugin folder (support scoped plugin names)
+ let pluginFolder = parts[1] || '';
+ if (pluginFolder.startsWith('@') && parts.length > 2) {
+ pluginFolder = `${pluginFolder}/${parts[2]}`;
+ }
+ pluginAbsRoot =
+ normalizedFile.slice(0, srcIdx + srcMarker.length) +
+ `plugins/${pluginFolder}/`;
+ pluginAbsRoot = normalize(pluginAbsRoot);
+ } else if (firstLevel === 'openApi') {
+ mode = 'openApi';
+ const apiFirst = parts[1] || '';
+ openApiFirstRoot =
+ normalizedFile.slice(0, srcIdx + srcMarker.length) +
+ `openApi/${apiFirst}/`;
+ openApiFirstRoot = normalize(openApiFirstRoot);
+ } else {
+ firstRoot =
+ normalizedFile.slice(0, srcIdx + srcMarker.length) + `${firstLevel}/`;
+ firstRoot = normalize(firstRoot);
+ }
+
+ function resolveFromBasedir(basedir, sourceValue) {
+ try {
+ return path.resolve(basedir, sourceValue);
+ } catch {
+ return null;
+ }
+ }
+
+ function resolveTildeToAbs(sourceValue) {
+ const rest = sourceValue.replace(/^~\/?/, '');
+ return path.resolve(process.cwd(), 'packages/openapi-ts/src', rest);
+ }
+
+ function toTilde(resolvedAbsolutePath) {
+ const normalized = normalize(resolvedAbsolutePath);
+ const marker = '/packages/openapi-ts/src/';
+ const i = normalized.indexOf(marker);
+ if (i === -1) return null;
+ let rest = normalized.slice(i + marker.length);
+ rest = stripExtAndIndex(rest);
+ return `~/${rest}`;
+ }
+
+ function reportReplaceWithTilde(node, sourceValue, message) {
+ const basedir = path.dirname(filename);
+ const resolved = resolveFromBasedir(basedir, sourceValue);
+ if (!resolved) return;
+ const newImport = toTilde(resolved);
+ if (!newImport) return;
+ context.report({
+ fix(fixer) {
+ return fixer.replaceText(node.source, `'${newImport}'`);
+ },
+ message,
+ node: node.source,
+ });
+ }
+
+ function reportReplaceWithRelative(node, sourceValue, message) {
+ const resolved = resolveTildeToAbs(sourceValue);
+ if (!resolved) return;
+ let relativePath = path
+ .relative(path.dirname(filename), resolved)
+ .split(path.sep)
+ .join('/');
+ relativePath = stripExtAndIndex(relativePath);
+ if (!relativePath.startsWith('.')) relativePath = `./${relativePath}`;
+ context.report({
+ fix(fixer) {
+ return fixer.replaceText(node.source, `'${relativePath}'`);
+ },
+ message,
+ node: node.source,
+ });
+ }
+
+ function shouldRewriteRelative(sourceValue) {
+ if (typeof sourceValue !== 'string') return false;
+ if (!sourceValue.startsWith('.')) return false;
+ const basedir = path.dirname(filename);
+ const resolved = resolveFromBasedir(basedir, sourceValue);
+ if (!resolved) return false;
+ const nr = normalize(resolved);
+ if (!nr.includes('/packages/openapi-ts/src/')) return false;
+
+ if (mode === 'plugins') {
+ if (nr.startsWith(pluginAbsRoot)) return false; // inside same plugin -> keep relative
+ if (nr.startsWith(bundleAbsRoot)) return false; // client-core bundle: keep relative
+ return true;
+ }
+
+ if (mode === 'openApi') {
+ // if target is inside same first-level openApi folder -> don't rewrite
+ if (nr.startsWith(openApiFirstRoot)) return false;
+ // only rewrite if target is inside openApi at all
+ return nr.includes('/packages/openapi-ts/src/openApi/');
+ }
+
+ // generic first-level folder rule
+ if (nr.startsWith(firstRoot)) return false;
+ return true;
+ }
+
+ function shouldRewriteTilde(sourceValue) {
+ if (typeof sourceValue !== 'string') return false;
+ if (!sourceValue.startsWith('~')) return false;
+ const resolved = resolveTildeToAbs(sourceValue);
+ if (!resolved) return false;
+ const nr = normalize(resolved);
+
+ if (mode === 'plugins') {
+ // prefer relative imports for same-plugin targets or for the shared client-core bundle
+ return nr.startsWith(pluginAbsRoot) || nr.startsWith(bundleAbsRoot);
+ }
+ if (mode === 'openApi') {
+ return nr.startsWith(openApiFirstRoot);
+ }
+ return nr.startsWith(firstRoot);
+ }
+
+ return {
+ ExportAllDeclaration(node) {
+ const sourceValue = node.source && node.source.value;
+ if (shouldRewriteRelative(sourceValue)) {
+ reportReplaceWithTilde(
+ node,
+ sourceValue,
+ 'Prefer `~` export for cross-boundary exports (autofixable).',
+ );
+ return;
+ }
+ if (shouldRewriteTilde(sourceValue)) {
+ reportReplaceWithRelative(
+ node,
+ sourceValue,
+ 'Prefer relative export for intra-boundary targets (autofixable).',
+ );
+ return;
+ }
+ },
+ ImportDeclaration(node) {
+ const sourceValue = node.source && node.source.value;
+ if (shouldRewriteRelative(sourceValue)) {
+ reportReplaceWithTilde(
+ node,
+ sourceValue,
+ 'Prefer `~` import for cross-boundary imports (autofixable).',
+ );
+ return;
+ }
+ if (shouldRewriteTilde(sourceValue)) {
+ reportReplaceWithRelative(
+ node,
+ sourceValue,
+ 'Prefer relative import for intra-boundary targets (autofixable).',
+ );
+ return;
+ }
+ },
+ };
+ },
+ meta: {
+ docs: {
+ description:
+ 'Enforce local import path boundaries for openapi-ts sources',
+ recommended: false,
+ },
+ fixable: 'code',
+ schema: [],
+ type: 'suggestion',
+ },
+};
+
+export default {
+ configs: {
+ recommended: {
+ rules: {
+ 'local-paths/enforce-local-paths': 'error',
+ },
+ },
+ },
+ rules: {
+ 'enforce-local-paths': enforceLocalPaths,
+ },
+};
diff --git a/eslint.config.js b/eslint.config.js
index 42826d4b0..93fb9b916 100644
--- a/eslint.config.js
+++ b/eslint.config.js
@@ -8,9 +8,12 @@ import pluginTypeScriptSortKeys from 'eslint-plugin-typescript-sort-keys';
import globals from 'globals';
import tseslint from 'typescript-eslint';
+import pluginLocalPaths from './eslint-rules/local-paths.js';
+
export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
+ pluginLocalPaths.configs.recommended,
{
languageOptions: {
ecmaVersion: 'latest',
@@ -19,6 +22,7 @@ export default tseslint.config(
},
},
plugins: {
+ 'local-paths': pluginLocalPaths,
'simple-import-sort': pluginSimpleImportSort,
'sort-destructure-keys': pluginSortDestructureKeys,
'sort-keys-fix': pluginSortKeysFix,
diff --git a/examples/README.md b/examples/README.md
new file mode 100644
index 000000000..6359053b1
--- /dev/null
+++ b/examples/README.md
@@ -0,0 +1,84 @@
+# Examples
+
+This directory contains integration examples demonstrating how to use `@hey-api/openapi-ts` with various frameworks, libraries, and client implementations.
+
+## Available Examples
+
+- **openapi-ts-angular** - Angular integration with common HTTP client
+- **openapi-ts-angular-common** - Angular with @angular/common/http
+- **openapi-ts-axios** - Using Axios client
+- **openapi-ts-fastify** - Fastify server integration
+- **openapi-ts-fetch** - Native Fetch API client
+- **openapi-ts-next** - Next.js integration
+- **openapi-ts-nuxt** - Nuxt.js integration with plugin
+- **openapi-ts-ofetch** - Using ofetch client
+- **openapi-ts-openai** - OpenAI API integration
+- **openapi-ts-pinia-colada** - Vue with Pinia Colada state management
+- **openapi-ts-sample** - Sample/template example (excluded from CI)
+- **openapi-ts-tanstack-angular-query-experimental** - Angular with TanStack Query
+- **openapi-ts-tanstack-react-query** - React with TanStack Query
+- **openapi-ts-tanstack-svelte-query** - Svelte with TanStack Query
+- **openapi-ts-tanstack-vue-query** - Vue with TanStack Query
+
+## Generated Code
+
+All examples (except `openapi-ts-sample`) contain generated client code that is **committed to the repository**. This ensures:
+
+1. Examples always reflect the current state of the code generator
+2. Changes to the code generator are visible in pull requests
+3. CI can verify that examples are kept up-to-date
+
+## Regenerating Examples
+
+After making changes to the core packages, regenerate all example code:
+
+```bash
+pnpm examples:generate
+```
+
+This command will run `openapi-ts` for each example that has an `openapi-ts` script in its `package.json`.
+
+## Verifying Examples
+
+To check if all examples are up-to-date with the current codebase:
+
+```bash
+pnpm examples:check
+```
+
+This check is also run automatically in CI. If it fails, run `pnpm examples:generate` and commit the changes.
+
+## Running Examples
+
+Each example can be run individually using the `example` script:
+
+```bash
+# Run dev server for fetch example
+pnpm example fetch dev
+
+# Build fetch example
+pnpm example fetch build
+```
+
+Or directly using pnpm filters:
+
+```bash
+pnpm --filter @example/openapi-ts-fetch dev
+```
+
+## Creating New Examples
+
+When creating a new example:
+
+1. Create a new directory in `examples/`
+2. Add an `openapi-ts` script to `package.json`
+3. Run `pnpm examples:generate` to create initial generated code
+4. Commit both the source and generated code
+5. The example will automatically be included in CI checks
+
+## Excluding Examples
+
+To exclude an example from CI (like `openapi-ts-sample`):
+
+1. Remove the `openapi-ts` script from `package.json`, or
+2. Update the exclusion filters in `package.json` scripts and `.github/workflows/ci.yml`
diff --git a/examples/openapi-ts-angular-common/src/client/@angular/common/http/resources.gen.ts b/examples/openapi-ts-angular-common/src/client/@angular/common.gen.ts
similarity index 53%
rename from examples/openapi-ts-angular-common/src/client/@angular/common/http/resources.gen.ts
rename to examples/openapi-ts-angular-common/src/client/@angular/common.gen.ts
index f4be36afb..e063c5925 100644
--- a/examples/openapi-ts-angular-common/src/client/@angular/common/http/resources.gen.ts
+++ b/examples/openapi-ts-angular-common/src/client/@angular/common.gen.ts
@@ -1,9 +1,10 @@
// This file is auto-generated by @hey-api/openapi-ts
-import { httpResource } from '@angular/common/http';
+import { type HttpRequest, httpResource } from '@angular/common/http';
import { Injectable } from '@angular/core';
-import type { Options } from '../../../sdk.gen';
+import { client } from '../client.gen';
+import type { Options } from '../sdk.gen';
import type {
AddPetData,
AddPetResponse,
@@ -38,28 +39,294 @@ import type {
UpdateUserData,
UploadFileData,
UploadFileResponse,
-} from '../../../types.gen';
-import {
- addPetRequest,
- createUserRequest,
- createUsersWithListInputRequest,
- deleteOrderRequest,
- deletePetRequest,
- deleteUserRequest,
- findPetsByStatusRequest,
- findPetsByTagsRequest,
- getInventoryRequest,
- getOrderByIdRequest,
- getPetByIdRequest,
- getUserByNameRequest,
- loginUserRequest,
- logoutUserRequest,
- placeOrderRequest,
- updatePetRequest,
- updatePetWithFormRequest,
- updateUserRequest,
- uploadFileRequest,
-} from './requests.gen';
+} from '../types.gen';
+
+/**
+ * Add a new pet to the store.
+ *
+ * Add a new pet to the store.
+ */
+export const addPetRequest = (
+ options: Options,
+): HttpRequest =>
+ (options?.client ?? client).requestOptions({
+ method: 'POST',
+ responseStyle: 'data',
+ url: '/pet',
+ ...options,
+ });
+
+/**
+ * Update an existing pet.
+ *
+ * Update an existing pet by Id.
+ */
+export const updatePetRequest = (
+ options: Options,
+): HttpRequest =>
+ (options?.client ?? client).requestOptions({
+ method: 'PUT',
+ responseStyle: 'data',
+ url: '/pet',
+ ...options,
+ });
+
+/**
+ * Finds Pets by status.
+ *
+ * Multiple status values can be provided with comma separated strings.
+ */
+export const findPetsByStatusRequest = (
+ options: Options,
+): HttpRequest =>
+ (options?.client ?? client).requestOptions({
+ method: 'GET',
+ responseStyle: 'data',
+ url: '/pet/findByStatus',
+ ...options,
+ });
+
+/**
+ * Finds Pets by tags.
+ *
+ * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
+ */
+export const findPetsByTagsRequest = (
+ options: Options,
+): HttpRequest =>
+ (options?.client ?? client).requestOptions({
+ method: 'GET',
+ responseStyle: 'data',
+ url: '/pet/findByTags',
+ ...options,
+ });
+
+/**
+ * Deletes a pet.
+ *
+ * Delete a pet.
+ */
+export const deletePetRequest = (
+ options: Options,
+): HttpRequest =>
+ (options?.client ?? client).requestOptions({
+ method: 'DELETE',
+ responseStyle: 'data',
+ url: '/pet/{petId}',
+ ...options,
+ });
+
+/**
+ * Find pet by ID.
+ *
+ * Returns a single pet.
+ */
+export const getPetByIdRequest = (
+ options: Options,
+): HttpRequest =>
+ (options?.client ?? client).requestOptions({
+ method: 'GET',
+ responseStyle: 'data',
+ url: '/pet/{petId}',
+ ...options,
+ });
+
+/**
+ * Updates a pet in the store with form data.
+ *
+ * Updates a pet resource based on the form data.
+ */
+export const updatePetWithFormRequest = (
+ options: Options,
+): HttpRequest =>
+ (options?.client ?? client).requestOptions({
+ method: 'POST',
+ responseStyle: 'data',
+ url: '/pet/{petId}',
+ ...options,
+ });
+
+/**
+ * Uploads an image.
+ *
+ * Upload image of the pet.
+ */
+export const uploadFileRequest = (
+ options: Options,
+): HttpRequest =>
+ (options?.client ?? client).requestOptions({
+ method: 'POST',
+ responseStyle: 'data',
+ url: '/pet/{petId}/uploadImage',
+ ...options,
+ });
+
+/**
+ * Returns pet inventories by status.
+ *
+ * Returns a map of status codes to quantities.
+ */
+export const getInventoryRequest = (
+ options?: Options,
+): HttpRequest =>
+ (options?.client ?? client).requestOptions({
+ method: 'GET',
+ responseStyle: 'data',
+ url: '/store/inventory',
+ ...options,
+ });
+
+/**
+ * Place an order for a pet.
+ *
+ * Place a new order in the store.
+ */
+export const placeOrderRequest = (
+ options?: Options,
+): HttpRequest =>
+ (options?.client ?? client).requestOptions({
+ method: 'POST',
+ responseStyle: 'data',
+ url: '/store/order',
+ ...options,
+ });
+
+/**
+ * Delete purchase order by identifier.
+ *
+ * For valid response try integer IDs with value < 1000. Anything above 1000 or non-integers will generate API errors.
+ */
+export const deleteOrderRequest = (
+ options: Options,
+): HttpRequest =>
+ (options?.client ?? client).requestOptions({
+ method: 'DELETE',
+ responseStyle: 'data',
+ url: '/store/order/{orderId}',
+ ...options,
+ });
+
+/**
+ * Find purchase order by ID.
+ *
+ * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions.
+ */
+export const getOrderByIdRequest = (
+ options: Options,
+): HttpRequest =>
+ (options?.client ?? client).requestOptions({
+ method: 'GET',
+ responseStyle: 'data',
+ url: '/store/order/{orderId}',
+ ...options,
+ });
+
+/**
+ * Create user.
+ *
+ * This can only be done by the logged in user.
+ */
+export const createUserRequest = (
+ options?: Options,
+): HttpRequest =>
+ (options?.client ?? client).requestOptions({
+ method: 'POST',
+ responseStyle: 'data',
+ url: '/user',
+ ...options,
+ });
+
+/**
+ * Creates list of users with given input array.
+ *
+ * Creates list of users with given input array.
+ */
+export const createUsersWithListInputRequest = <
+ ThrowOnError extends boolean = false,
+>(
+ options?: Options,
+): HttpRequest =>
+ (options?.client ?? client).requestOptions({
+ method: 'POST',
+ responseStyle: 'data',
+ url: '/user/createWithList',
+ ...options,
+ });
+
+/**
+ * Logs user into the system.
+ *
+ * Log into the system.
+ */
+export const loginUserRequest = (
+ options?: Options,
+): HttpRequest =>
+ (options?.client ?? client).requestOptions({
+ method: 'GET',
+ responseStyle: 'data',
+ url: '/user/login',
+ ...options,
+ });
+
+/**
+ * Logs out current logged in user session.
+ *
+ * Log user out of the system.
+ */
+export const logoutUserRequest = (
+ options?: Options,
+): HttpRequest =>
+ (options?.client ?? client).requestOptions({
+ method: 'GET',
+ responseStyle: 'data',
+ url: '/user/logout',
+ ...options,
+ });
+
+/**
+ * Delete user resource.
+ *
+ * This can only be done by the logged in user.
+ */
+export const deleteUserRequest = (
+ options: Options,
+): HttpRequest =>
+ (options?.client ?? client).requestOptions({
+ method: 'DELETE',
+ responseStyle: 'data',
+ url: '/user/{username}',
+ ...options,
+ });
+
+/**
+ * Get user by user name.
+ *
+ * Get user detail based on username.
+ */
+export const getUserByNameRequest = (
+ options: Options,
+): HttpRequest =>
+ (options?.client ?? client).requestOptions({
+ method: 'GET',
+ responseStyle: 'data',
+ url: '/user/{username}',
+ ...options,
+ });
+
+/**
+ * Update user resource.
+ *
+ * This can only be done by the logged in user.
+ */
+export const updateUserRequest = (
+ options: Options,
+): HttpRequest =>
+ (options?.client ?? client).requestOptions({
+ method: 'PUT',
+ responseStyle: 'data',
+ url: '/user/{username}',
+ ...options,
+ });
@Injectable({
providedIn: 'root',
@@ -67,6 +334,7 @@ import {
export class PetServiceResources {
/**
* Add a new pet to the store.
+ *
* Add a new pet to the store.
*/
public addPet(
@@ -80,6 +348,7 @@ export class PetServiceResources {
/**
* Update an existing pet.
+ *
* Update an existing pet by Id.
*/
public updatePet(
@@ -93,6 +362,7 @@ export class PetServiceResources {
/**
* Finds Pets by status.
+ *
* Multiple status values can be provided with comma separated strings.
*/
public findPetsByStatus(
@@ -106,6 +376,7 @@ export class PetServiceResources {
/**
* Finds Pets by tags.
+ *
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
*/
public findPetsByTags(
@@ -119,6 +390,7 @@ export class PetServiceResources {
/**
* Deletes a pet.
+ *
* Delete a pet.
*/
public deletePet(
@@ -132,6 +404,7 @@ export class PetServiceResources {
/**
* Find pet by ID.
+ *
* Returns a single pet.
*/
public getPetById(
@@ -145,6 +418,7 @@ export class PetServiceResources {
/**
* Updates a pet in the store with form data.
+ *
* Updates a pet resource based on the form data.
*/
public updatePetWithForm(
@@ -158,6 +432,7 @@ export class PetServiceResources {
/**
* Uploads an image.
+ *
* Upload image of the pet.
*/
public uploadFile(
@@ -176,6 +451,7 @@ export class PetServiceResources {
export class StoreServiceResources {
/**
* Returns pet inventories by status.
+ *
* Returns a map of status codes to quantities.
*/
public getInventory(
@@ -189,6 +465,7 @@ export class StoreServiceResources {
/**
* Place an order for a pet.
+ *
* Place a new order in the store.
*/
public placeOrder(
@@ -202,6 +479,7 @@ export class StoreServiceResources {
/**
* Delete purchase order by identifier.
+ *
* For valid response try integer IDs with value < 1000. Anything above 1000 or non-integers will generate API errors.
*/
public deleteOrder(
@@ -215,6 +493,7 @@ export class StoreServiceResources {
/**
* Find purchase order by ID.
+ *
* For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions.
*/
public getOrderById(
@@ -233,6 +512,7 @@ export class StoreServiceResources {
export class UserServiceResources {
/**
* Create user.
+ *
* This can only be done by the logged in user.
*/
public createUser(
@@ -246,6 +526,7 @@ export class UserServiceResources {
/**
* Creates list of users with given input array.
+ *
* Creates list of users with given input array.
*/
public createUsersWithListInput(
@@ -261,6 +542,7 @@ export class UserServiceResources {
/**
* Logs user into the system.
+ *
* Log into the system.
*/
public loginUser(
@@ -274,6 +556,7 @@ export class UserServiceResources {
/**
* Logs out current logged in user session.
+ *
* Log user out of the system.
*/
public logoutUser(
@@ -287,6 +570,7 @@ export class UserServiceResources {
/**
* Delete user resource.
+ *
* This can only be done by the logged in user.
*/
public deleteUser(
@@ -300,6 +584,7 @@ export class UserServiceResources {
/**
* Get user by user name.
+ *
* Get user detail based on username.
*/
public getUserByName(
@@ -313,6 +598,7 @@ export class UserServiceResources {
/**
* Update user resource.
+ *
* This can only be done by the logged in user.
*/
public updateUser(
diff --git a/examples/openapi-ts-angular-common/src/client/@angular/common/http/requests.gen.ts b/examples/openapi-ts-angular-common/src/client/@angular/common/http/requests.gen.ts
deleted file mode 100644
index e66f2fbc8..000000000
--- a/examples/openapi-ts-angular-common/src/client/@angular/common/http/requests.gen.ts
+++ /dev/null
@@ -1,295 +0,0 @@
-// This file is auto-generated by @hey-api/openapi-ts
-
-import type { HttpRequest } from '@angular/common/http';
-
-import { client as _heyApiClient } from '../../../client.gen';
-import type { Options } from '../../../sdk.gen';
-import type {
- AddPetData,
- CreateUserData,
- CreateUsersWithListInputData,
- DeleteOrderData,
- DeletePetData,
- DeleteUserData,
- FindPetsByStatusData,
- FindPetsByTagsData,
- GetInventoryData,
- GetOrderByIdData,
- GetPetByIdData,
- GetUserByNameData,
- LoginUserData,
- LogoutUserData,
- PlaceOrderData,
- UpdatePetData,
- UpdatePetWithFormData,
- UpdateUserData,
- UploadFileData,
-} from '../../../types.gen';
-
-/**
- * Add a new pet to the store.
- * Add a new pet to the store.
- */
-export const addPetRequest = (
- options: Options,
-): HttpRequest =>
- (options?.client ?? _heyApiClient).requestOptions({
- method: 'POST',
- responseStyle: 'data',
- url: '/pet',
- ...options,
- });
-
-/**
- * Update an existing pet.
- * Update an existing pet by Id.
- */
-export const updatePetRequest = (
- options: Options,
-): HttpRequest =>
- (options?.client ?? _heyApiClient).requestOptions({
- method: 'PUT',
- responseStyle: 'data',
- url: '/pet',
- ...options,
- });
-
-/**
- * Finds Pets by status.
- * Multiple status values can be provided with comma separated strings.
- */
-export const findPetsByStatusRequest = (
- options: Options,
-): HttpRequest =>
- (options?.client ?? _heyApiClient).requestOptions({
- method: 'GET',
- responseStyle: 'data',
- url: '/pet/findByStatus',
- ...options,
- });
-
-/**
- * Finds Pets by tags.
- * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
- */
-export const findPetsByTagsRequest = (
- options: Options,
-): HttpRequest =>
- (options?.client ?? _heyApiClient).requestOptions({
- method: 'GET',
- responseStyle: 'data',
- url: '/pet/findByTags',
- ...options,
- });
-
-/**
- * Deletes a pet.
- * Delete a pet.
- */
-export const deletePetRequest = (
- options: Options,
-): HttpRequest =>
- (options?.client ?? _heyApiClient).requestOptions({
- method: 'DELETE',
- responseStyle: 'data',
- url: '/pet/{petId}',
- ...options,
- });
-
-/**
- * Find pet by ID.
- * Returns a single pet.
- */
-export const getPetByIdRequest = (
- options: Options,
-): HttpRequest =>
- (options?.client ?? _heyApiClient).requestOptions({
- method: 'GET',
- responseStyle: 'data',
- url: '/pet/{petId}',
- ...options,
- });
-
-/**
- * Updates a pet in the store with form data.
- * Updates a pet resource based on the form data.
- */
-export const updatePetWithFormRequest = (
- options: Options,
-): HttpRequest =>
- (options?.client ?? _heyApiClient).requestOptions({
- method: 'POST',
- responseStyle: 'data',
- url: '/pet/{petId}',
- ...options,
- });
-
-/**
- * Uploads an image.
- * Upload image of the pet.
- */
-export const uploadFileRequest = (
- options: Options,
-): HttpRequest =>
- (options?.client ?? _heyApiClient).requestOptions({
- method: 'POST',
- responseStyle: 'data',
- url: '/pet/{petId}/uploadImage',
- ...options,
- });
-
-/**
- * Returns pet inventories by status.
- * Returns a map of status codes to quantities.
- */
-export const getInventoryRequest = (
- options?: Options,
-): HttpRequest =>
- (options?.client ?? _heyApiClient).requestOptions({
- method: 'GET',
- responseStyle: 'data',
- url: '/store/inventory',
- ...options,
- });
-
-/**
- * Place an order for a pet.
- * Place a new order in the store.
- */
-export const placeOrderRequest = (
- options?: Options,
-): HttpRequest =>
- (options?.client ?? _heyApiClient).requestOptions({
- method: 'POST',
- responseStyle: 'data',
- url: '/store/order',
- ...options,
- });
-
-/**
- * Delete purchase order by identifier.
- * For valid response try integer IDs with value < 1000. Anything above 1000 or non-integers will generate API errors.
- */
-export const deleteOrderRequest = (
- options: Options,
-): HttpRequest =>
- (options?.client ?? _heyApiClient).requestOptions({
- method: 'DELETE',
- responseStyle: 'data',
- url: '/store/order/{orderId}',
- ...options,
- });
-
-/**
- * Find purchase order by ID.
- * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions.
- */
-export const getOrderByIdRequest = (
- options: Options,
-): HttpRequest =>
- (options?.client ?? _heyApiClient).requestOptions({
- method: 'GET',
- responseStyle: 'data',
- url: '/store/order/{orderId}',
- ...options,
- });
-
-/**
- * Create user.
- * This can only be done by the logged in user.
- */
-export const createUserRequest = (
- options?: Options,
-): HttpRequest =>
- (options?.client ?? _heyApiClient).requestOptions({
- method: 'POST',
- responseStyle: 'data',
- url: '/user',
- ...options,
- });
-
-/**
- * Creates list of users with given input array.
- * Creates list of users with given input array.
- */
-export const createUsersWithListInputRequest = <
- ThrowOnError extends boolean = false,
->(
- options?: Options,
-): HttpRequest =>
- (options?.client ?? _heyApiClient).requestOptions({
- method: 'POST',
- responseStyle: 'data',
- url: '/user/createWithList',
- ...options,
- });
-
-/**
- * Logs user into the system.
- * Log into the system.
- */
-export const loginUserRequest = (
- options?: Options,
-): HttpRequest =>
- (options?.client ?? _heyApiClient).requestOptions({
- method: 'GET',
- responseStyle: 'data',
- url: '/user/login',
- ...options,
- });
-
-/**
- * Logs out current logged in user session.
- * Log user out of the system.
- */
-export const logoutUserRequest = (
- options?: Options,
-): HttpRequest =>
- (options?.client ?? _heyApiClient).requestOptions({
- method: 'GET',
- responseStyle: 'data',
- url: '/user/logout',
- ...options,
- });
-
-/**
- * Delete user resource.
- * This can only be done by the logged in user.
- */
-export const deleteUserRequest = (
- options: Options,
-): HttpRequest =>
- (options?.client ?? _heyApiClient).requestOptions({
- method: 'DELETE',
- responseStyle: 'data',
- url: '/user/{username}',
- ...options,
- });
-
-/**
- * Get user by user name.
- * Get user detail based on username.
- */
-export const getUserByNameRequest = (
- options: Options,
-): HttpRequest =>
- (options?.client ?? _heyApiClient).requestOptions({
- method: 'GET',
- responseStyle: 'data',
- url: '/user/{username}',
- ...options,
- });
-
-/**
- * Update user resource.
- * This can only be done by the logged in user.
- */
-export const updateUserRequest = (
- options: Options,
-): HttpRequest =>
- (options?.client ?? _heyApiClient).requestOptions({
- method: 'PUT',
- responseStyle: 'data',
- url: '/user/{username}',
- ...options,
- });
diff --git a/examples/openapi-ts-angular-common/src/client/client.gen.ts b/examples/openapi-ts-angular-common/src/client/client.gen.ts
index 37fae577c..5bd9edd4b 100644
--- a/examples/openapi-ts-angular-common/src/client/client.gen.ts
+++ b/examples/openapi-ts-angular-common/src/client/client.gen.ts
@@ -1,12 +1,12 @@
// This file is auto-generated by @hey-api/openapi-ts
import {
- type ClientOptions as DefaultClientOptions,
+ type ClientOptions,
type Config,
createClient,
createConfig,
} from './client';
-import type { ClientOptions } from './types.gen';
+import type { ClientOptions as ClientOptions2 } from './types.gen';
/**
* The `createClientConfig()` function will be called on client initialization
@@ -16,13 +16,12 @@ import type { ClientOptions } from './types.gen';
* `setConfig()`. This is useful for example if you're using Next.js
* to ensure your client always has the correct values.
*/
-export type CreateClientConfig =
- (
- override?: Config,
- ) => Config & T>;
+export type CreateClientConfig = (
+ override?: Config,
+) => Config & T>;
export const client = createClient(
- createConfig({
+ createConfig({
baseUrl: 'https://petstore3.swagger.io/api/v3',
throwOnError: true,
}),
diff --git a/examples/openapi-ts-angular-common/src/client/client/client.gen.ts b/examples/openapi-ts-angular-common/src/client/client/client.gen.ts
index 93b77ace4..1555ca230 100644
--- a/examples/openapi-ts-angular-common/src/client/client/client.gen.ts
+++ b/examples/openapi-ts-angular-common/src/client/client/client.gen.ts
@@ -18,6 +18,7 @@ import { filter } from 'rxjs/operators';
import { createSseClient } from '../core/serverSentEvents.gen';
import type { HttpMethod } from '../core/types.gen';
+import { getValidRequestBody } from '../core/utils.gen';
import type {
Client,
Config,
@@ -69,7 +70,7 @@ export const createClient = (config: Config = {}): Client => {
...options,
headers: mergeHeaders(_config.headers, options.headers),
httpClient: options.httpClient ?? _config.httpClient,
- serializedBody: options.body as any,
+ serializedBody: undefined,
};
if (!opts.httpClient) {
@@ -83,12 +84,12 @@ export const createClient = (config: Config = {}): Client => {
}
}
- if (opts.body && opts.bodySerializer) {
+ if (opts.body !== undefined && opts.bodySerializer) {
opts.serializedBody = opts.bodySerializer(opts.body);
}
// remove Content-Type header if body is empty to avoid sending invalid requests
- if (opts.serializedBody === undefined || opts.serializedBody === '') {
+ if (opts.body === undefined || opts.serializedBody === '') {
opts.headers.delete('Content-Type');
}
@@ -97,7 +98,7 @@ export const createClient = (config: Config = {}): Client => {
const req = new HttpRequest(
opts.method ?? 'GET',
url,
- opts.serializedBody || null,
+ getValidRequestBody(opts),
{
redirect: 'follow',
...opts,
@@ -130,7 +131,7 @@ export const createClient = (config: Config = {}): Client => {
let req = initialReq;
- for (const fn of interceptors.request._fns) {
+ for (const fn of interceptors.request.fns) {
if (fn) {
req = await fn(req, opts as any);
}
@@ -151,7 +152,7 @@ export const createClient = (config: Config = {}): Client => {
.pipe(filter((event) => event.type === HttpEventType.Response)),
)) as HttpResponse;
- for (const fn of interceptors.response._fns) {
+ for (const fn of interceptors.response.fns) {
if (fn) {
result.response = await fn(result.response, req, opts as any);
}
@@ -177,7 +178,7 @@ export const createClient = (config: Config = {}): Client => {
let finalError = error instanceof HttpErrorResponse ? error.error : error;
- for (const fn of interceptors.error._fns) {
+ for (const fn of interceptors.error.fns) {
if (fn) {
finalError = (await fn(
finalError,
diff --git a/examples/openapi-ts-angular-common/src/client/client/index.ts b/examples/openapi-ts-angular-common/src/client/client/index.ts
index 318a84b6a..cbf8dfeed 100644
--- a/examples/openapi-ts-angular-common/src/client/client/index.ts
+++ b/examples/openapi-ts-angular-common/src/client/client/index.ts
@@ -8,6 +8,7 @@ export {
urlSearchParamsBodySerializer,
} from '../core/bodySerializer.gen';
export { buildClientParams } from '../core/params.gen';
+export { serializeQueryKeyValue } from '../core/queryKeySerializer.gen';
export { createClient } from './client.gen';
export type {
Client,
diff --git a/examples/openapi-ts-angular-common/src/client/client/utils.gen.ts b/examples/openapi-ts-angular-common/src/client/client/utils.gen.ts
index b90ad7e5e..64a5d8b09 100644
--- a/examples/openapi-ts-angular-common/src/client/client/utils.gen.ts
+++ b/examples/openapi-ts-angular-common/src/client/client/utils.gen.ts
@@ -345,67 +345,61 @@ type ResInterceptor = (
) => Res | Promise;
class Interceptors {
- _fns: (Interceptor | null)[];
+ fns: Array = [];
- constructor() {
- this._fns = [];
+ clear(): void {
+ this.fns = [];
}
- clear() {
- this._fns = [];
- }
-
- getInterceptorIndex(id: number | Interceptor): number {
- if (typeof id === 'number') {
- return this._fns[id] ? id : -1;
- } else {
- return this._fns.indexOf(id);
+ eject(id: number | Interceptor): void {
+ const index = this.getInterceptorIndex(id);
+ if (this.fns[index]) {
+ this.fns[index] = null;
}
}
- exists(id: number | Interceptor) {
+
+ exists(id: number | Interceptor): boolean {
const index = this.getInterceptorIndex(id);
- return !!this._fns[index];
+ return Boolean(this.fns[index]);
}
- eject(id: number | Interceptor) {
- const index = this.getInterceptorIndex(id);
- if (this._fns[index]) {
- this._fns[index] = null;
+ getInterceptorIndex(id: number | Interceptor): number {
+ if (typeof id === 'number') {
+ return this.fns[id] ? id : -1;
}
+ return this.fns.indexOf(id);
}
- update(id: number | Interceptor, fn: Interceptor) {
+ update(
+ id: number | Interceptor,
+ fn: Interceptor,
+ ): number | Interceptor | false {
const index = this.getInterceptorIndex(id);
- if (this._fns[index]) {
- this._fns[index] = fn;
+ if (this.fns[index]) {
+ this.fns[index] = fn;
return id;
- } else {
- return false;
}
+ return false;
}
- use(fn: Interceptor) {
- this._fns = [...this._fns, fn];
- return this._fns.length - 1;
+ use(fn: Interceptor): number {
+ this.fns.push(fn);
+ return this.fns.length - 1;
}
}
-// `createInterceptors()` response, meant for external use as it does not
-// expose internals
export interface Middleware {
- error: Pick<
- Interceptors>,
- 'eject' | 'use'
- >;
- request: Pick>, 'eject' | 'use'>;
- response: Pick<
- Interceptors>,
- 'eject' | 'use'
- >;
+ error: Interceptors>;
+ request: Interceptors>;
+ response: Interceptors>;
}
-// do not add `Middleware` as return type so we can use _fns internally
-export const createInterceptors = () => ({
+export const createInterceptors = (): Middleware<
+ Req,
+ Res,
+ Err,
+ Options
+> => ({
error: new Interceptors>(),
request: new Interceptors>(),
response: new Interceptors>(),
diff --git a/examples/openapi-ts-angular-common/src/client/core/queryKeySerializer.gen.ts b/examples/openapi-ts-angular-common/src/client/core/queryKeySerializer.gen.ts
new file mode 100644
index 000000000..d3bb68396
--- /dev/null
+++ b/examples/openapi-ts-angular-common/src/client/core/queryKeySerializer.gen.ts
@@ -0,0 +1,136 @@
+// This file is auto-generated by @hey-api/openapi-ts
+
+/**
+ * JSON-friendly union that mirrors what Pinia Colada can hash.
+ */
+export type JsonValue =
+ | null
+ | string
+ | number
+ | boolean
+ | JsonValue[]
+ | { [key: string]: JsonValue };
+
+/**
+ * Replacer that converts non-JSON values (bigint, Date, etc.) to safe substitutes.
+ */
+export const queryKeyJsonReplacer = (_key: string, value: unknown) => {
+ if (
+ value === undefined ||
+ typeof value === 'function' ||
+ typeof value === 'symbol'
+ ) {
+ return undefined;
+ }
+ if (typeof value === 'bigint') {
+ return value.toString();
+ }
+ if (value instanceof Date) {
+ return value.toISOString();
+ }
+ return value;
+};
+
+/**
+ * Safely stringifies a value and parses it back into a JsonValue.
+ */
+export const stringifyToJsonValue = (input: unknown): JsonValue | undefined => {
+ try {
+ const json = JSON.stringify(input, queryKeyJsonReplacer);
+ if (json === undefined) {
+ return undefined;
+ }
+ return JSON.parse(json) as JsonValue;
+ } catch {
+ return undefined;
+ }
+};
+
+/**
+ * Detects plain objects (including objects with a null prototype).
+ */
+const isPlainObject = (value: unknown): value is Record => {
+ if (value === null || typeof value !== 'object') {
+ return false;
+ }
+ const prototype = Object.getPrototypeOf(value as object);
+ return prototype === Object.prototype || prototype === null;
+};
+
+/**
+ * Turns URLSearchParams into a sorted JSON object for deterministic keys.
+ */
+const serializeSearchParams = (params: URLSearchParams): JsonValue => {
+ const entries = Array.from(params.entries()).sort(([a], [b]) =>
+ a.localeCompare(b),
+ );
+ const result: Record = {};
+
+ for (const [key, value] of entries) {
+ const existing = result[key];
+ if (existing === undefined) {
+ result[key] = value;
+ continue;
+ }
+
+ if (Array.isArray(existing)) {
+ (existing as string[]).push(value);
+ } else {
+ result[key] = [existing, value];
+ }
+ }
+
+ return result;
+};
+
+/**
+ * Normalizes any accepted value into a JSON-friendly shape for query keys.
+ */
+export const serializeQueryKeyValue = (
+ value: unknown,
+): JsonValue | undefined => {
+ if (value === null) {
+ return null;
+ }
+
+ if (
+ typeof value === 'string' ||
+ typeof value === 'number' ||
+ typeof value === 'boolean'
+ ) {
+ return value;
+ }
+
+ if (
+ value === undefined ||
+ typeof value === 'function' ||
+ typeof value === 'symbol'
+ ) {
+ return undefined;
+ }
+
+ if (typeof value === 'bigint') {
+ return value.toString();
+ }
+
+ if (value instanceof Date) {
+ return value.toISOString();
+ }
+
+ if (Array.isArray(value)) {
+ return stringifyToJsonValue(value);
+ }
+
+ if (
+ typeof URLSearchParams !== 'undefined' &&
+ value instanceof URLSearchParams
+ ) {
+ return serializeSearchParams(value);
+ }
+
+ if (isPlainObject(value)) {
+ return stringifyToJsonValue(value);
+ }
+
+ return undefined;
+};
diff --git a/examples/openapi-ts-angular-common/src/client/core/utils.gen.ts b/examples/openapi-ts-angular-common/src/client/core/utils.gen.ts
index ac31396fe..0b5389d08 100644
--- a/examples/openapi-ts-angular-common/src/client/core/utils.gen.ts
+++ b/examples/openapi-ts-angular-common/src/client/core/utils.gen.ts
@@ -1,6 +1,6 @@
// This file is auto-generated by @hey-api/openapi-ts
-import type { QuerySerializer } from './bodySerializer.gen';
+import type { BodySerializer, QuerySerializer } from './bodySerializer.gen';
import {
type ArraySeparatorStyle,
serializeArrayParam,
@@ -112,3 +112,32 @@ export const getUrl = ({
}
return url;
};
+
+export function getValidRequestBody(options: {
+ body?: unknown;
+ bodySerializer?: BodySerializer | null;
+ serializedBody?: unknown;
+}) {
+ const hasBody = options.body !== undefined;
+ const isSerializedBody = hasBody && options.bodySerializer;
+
+ if (isSerializedBody) {
+ if ('serializedBody' in options) {
+ const hasSerializedBody =
+ options.serializedBody !== undefined && options.serializedBody !== '';
+
+ return hasSerializedBody ? options.serializedBody : null;
+ }
+
+ // not all clients implement a serializedBody property (i.e. client-axios)
+ return options.body !== '' ? options.body : null;
+ }
+
+ // plain/text body
+ if (hasBody) {
+ return options.body;
+ }
+
+ // no body was provided
+ return undefined;
+}
diff --git a/examples/openapi-ts-angular-common/src/client/index.ts b/examples/openapi-ts-angular-common/src/client/index.ts
index 6921f209d..89fcd5868 100644
--- a/examples/openapi-ts-angular-common/src/client/index.ts
+++ b/examples/openapi-ts-angular-common/src/client/index.ts
@@ -1,5 +1,5 @@
// This file is auto-generated by @hey-api/openapi-ts
-export * from './@angular/common/http/requests.gen';
-export * from './@angular/common/http/resources.gen';
+
+export * from './@angular/common.gen';
export * from './sdk.gen';
-export * from './types.gen';
+export type * from './types.gen';
diff --git a/examples/openapi-ts-angular-common/src/client/sdk.gen.ts b/examples/openapi-ts-angular-common/src/client/sdk.gen.ts
index 072abae41..d1c943a6c 100644
--- a/examples/openapi-ts-angular-common/src/client/sdk.gen.ts
+++ b/examples/openapi-ts-angular-common/src/client/sdk.gen.ts
@@ -1,7 +1,7 @@
// This file is auto-generated by @hey-api/openapi-ts
-import type { Client, Options as ClientOptions, TDataShape } from './client';
-import { client as _heyApiClient } from './client.gen';
+import type { Client, Options as Options2, TDataShape } from './client';
+import { client } from './client.gen';
import type {
AddPetData,
AddPetErrors,
@@ -65,7 +65,7 @@ import type {
export type Options<
TData extends TDataShape = TDataShape,
ThrowOnError extends boolean = boolean,
-> = ClientOptions & {
+> = Options2 & {
/**
* You can provide a client instance returned by `createClient()` instead of
* individual options. This might be also useful if you want to implement a
@@ -81,12 +81,13 @@ export type Options<
/**
* Add a new pet to the store.
+ *
* Add a new pet to the store.
*/
export const addPet = (
options: Options,
) =>
- (options.client ?? _heyApiClient).post<
+ (options.client ?? client).post<
AddPetResponses,
AddPetErrors,
ThrowOnError,
@@ -109,12 +110,13 @@ export const addPet = (
/**
* Update an existing pet.
+ *
* Update an existing pet by Id.
*/
export const updatePet = (
options: Options,
) =>
- (options.client ?? _heyApiClient).put<
+ (options.client ?? client).put<
UpdatePetResponses,
UpdatePetErrors,
ThrowOnError,
@@ -137,12 +139,13 @@ export const updatePet = (
/**
* Finds Pets by status.
+ *
* Multiple status values can be provided with comma separated strings.
*/
export const findPetsByStatus = (
options: Options,
) =>
- (options.client ?? _heyApiClient).get<
+ (options.client ?? client).get<
FindPetsByStatusResponses,
FindPetsByStatusErrors,
ThrowOnError,
@@ -161,12 +164,13 @@ export const findPetsByStatus = (
/**
* Finds Pets by tags.
+ *
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
*/
export const findPetsByTags = (
options: Options,
) =>
- (options.client ?? _heyApiClient).get<
+ (options.client ?? client).get<
FindPetsByTagsResponses,
FindPetsByTagsErrors,
ThrowOnError,
@@ -185,12 +189,13 @@ export const findPetsByTags = (
/**
* Deletes a pet.
+ *
* Delete a pet.
*/
export const deletePet = (
options: Options,
) =>
- (options.client ?? _heyApiClient).delete<
+ (options.client ?? client).delete<
DeletePetResponses,
DeletePetErrors,
ThrowOnError,
@@ -209,12 +214,13 @@ export const deletePet = (
/**
* Find pet by ID.
+ *
* Returns a single pet.
*/
export const getPetById = (
options: Options,
) =>
- (options.client ?? _heyApiClient).get<
+ (options.client ?? client).get<
GetPetByIdResponses,
GetPetByIdErrors,
ThrowOnError,
@@ -237,12 +243,13 @@ export const getPetById = (
/**
* Updates a pet in the store with form data.
+ *
* Updates a pet resource based on the form data.
*/
export const updatePetWithForm = (
options: Options,
) =>
- (options.client ?? _heyApiClient).post<
+ (options.client ?? client).post<
UpdatePetWithFormResponses,
UpdatePetWithFormErrors,
ThrowOnError,
@@ -261,12 +268,13 @@ export const updatePetWithForm = (
/**
* Uploads an image.
+ *
* Upload image of the pet.
*/
export const uploadFile = (
options: Options,
) =>
- (options.client ?? _heyApiClient).post<
+ (options.client ?? client).post<
UploadFileResponses,
UploadFileErrors,
ThrowOnError,
@@ -290,12 +298,13 @@ export const uploadFile = (
/**
* Returns pet inventories by status.
+ *
* Returns a map of status codes to quantities.
*/
export const getInventory = (
options?: Options,
) =>
- (options?.client ?? _heyApiClient).get<
+ (options?.client ?? client).get<
GetInventoryResponses,
GetInventoryErrors,
ThrowOnError,
@@ -314,12 +323,13 @@ export const getInventory = (
/**
* Place an order for a pet.
+ *
* Place a new order in the store.
*/
export const placeOrder = (
options?: Options,
) =>
- (options?.client ?? _heyApiClient).post<
+ (options?.client ?? client).post<
PlaceOrderResponses,
PlaceOrderErrors,
ThrowOnError,
@@ -336,12 +346,13 @@ export const placeOrder = (
/**
* Delete purchase order by identifier.
+ *
* For valid response try integer IDs with value < 1000. Anything above 1000 or non-integers will generate API errors.
*/
export const deleteOrder = (
options: Options,
) =>
- (options.client ?? _heyApiClient).delete<
+ (options.client ?? client).delete<
DeleteOrderResponses,
DeleteOrderErrors,
ThrowOnError,
@@ -354,12 +365,13 @@ export const deleteOrder = (
/**
* Find purchase order by ID.
+ *
* For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions.
*/
export const getOrderById = (
options: Options,
) =>
- (options.client ?? _heyApiClient).get<
+ (options.client ?? client).get<
GetOrderByIdResponses,
GetOrderByIdErrors,
ThrowOnError,
@@ -372,12 +384,13 @@ export const getOrderById = (
/**
* Create user.
+ *
* This can only be done by the logged in user.
*/
export const createUser = (
options?: Options,
) =>
- (options?.client ?? _heyApiClient).post<
+ (options?.client ?? client).post<
CreateUserResponses,
CreateUserErrors,
ThrowOnError,
@@ -394,12 +407,13 @@ export const createUser = (
/**
* Creates list of users with given input array.
+ *
* Creates list of users with given input array.
*/
export const createUsersWithListInput = (
options?: Options,
) =>
- (options?.client ?? _heyApiClient).post<
+ (options?.client ?? client).post<
CreateUsersWithListInputResponses,
CreateUsersWithListInputErrors,
ThrowOnError,
@@ -416,12 +430,13 @@ export const createUsersWithListInput = (
/**
* Logs user into the system.
+ *
* Log into the system.
*/
export const loginUser = (
options?: Options,
) =>
- (options?.client ?? _heyApiClient).get<
+ (options?.client ?? client).get<
LoginUserResponses,
LoginUserErrors,
ThrowOnError,
@@ -434,12 +449,13 @@ export const loginUser = (
/**
* Logs out current logged in user session.
+ *
* Log user out of the system.
*/
export const logoutUser = (
options?: Options,
) =>
- (options?.client ?? _heyApiClient).get<
+ (options?.client ?? client).get<
LogoutUserResponses,
LogoutUserErrors,
ThrowOnError,
@@ -452,12 +468,13 @@ export const logoutUser = (
/**
* Delete user resource.
+ *
* This can only be done by the logged in user.
*/
export const deleteUser = (
options: Options,
) =>
- (options.client ?? _heyApiClient).delete<
+ (options.client ?? client).delete<
DeleteUserResponses,
DeleteUserErrors,
ThrowOnError,
@@ -470,12 +487,13 @@ export const deleteUser = (
/**
* Get user by user name.
+ *
* Get user detail based on username.
*/
export const getUserByName = (
options: Options,
) =>
- (options.client ?? _heyApiClient).get<
+ (options.client ?? client).get<
GetUserByNameResponses,
GetUserByNameErrors,
ThrowOnError,
@@ -488,12 +506,13 @@ export const getUserByName = (
/**
* Update user resource.
+ *
* This can only be done by the logged in user.
*/
export const updateUser = (
options: Options,
) =>
- (options.client ?? _heyApiClient).put<
+ (options.client ?? client).put<
UpdateUserResponses,
UpdateUserErrors,
ThrowOnError,
diff --git a/examples/openapi-ts-angular-common/src/client/types.gen.ts b/examples/openapi-ts-angular-common/src/client/types.gen.ts
index 992c17fb2..a2e6be0fa 100644
--- a/examples/openapi-ts-angular-common/src/client/types.gen.ts
+++ b/examples/openapi-ts-angular-common/src/client/types.gen.ts
@@ -1,5 +1,9 @@
// This file is auto-generated by @hey-api/openapi-ts
+export type ClientOptions = {
+ baseUrl: 'https://petstore3.swagger.io/api/v3' | (string & {});
+};
+
export type Order = {
complete?: boolean;
id?: number;
@@ -693,7 +697,3 @@ export type UpdateUserResponses = {
*/
200: unknown;
};
-
-export type ClientOptions = {
- baseUrl: 'https://petstore3.swagger.io/api/v3' | (string & {});
-};
diff --git a/examples/openapi-ts-angular/src/client/client.gen.ts b/examples/openapi-ts-angular/src/client/client.gen.ts
index f1e680045..069f4daba 100644
--- a/examples/openapi-ts-angular/src/client/client.gen.ts
+++ b/examples/openapi-ts-angular/src/client/client.gen.ts
@@ -1,12 +1,12 @@
// This file is auto-generated by @hey-api/openapi-ts
import {
- type ClientOptions as DefaultClientOptions,
+ type ClientOptions,
type Config,
createClient,
createConfig,
} from './client';
-import type { ClientOptions } from './types.gen';
+import type { ClientOptions as ClientOptions2 } from './types.gen';
/**
* The `createClientConfig()` function will be called on client initialization
@@ -16,13 +16,12 @@ import type { ClientOptions } from './types.gen';
* `setConfig()`. This is useful for example if you're using Next.js
* to ensure your client always has the correct values.
*/
-export type CreateClientConfig =
- (
- override?: Config,
- ) => Config & T>;
+export type CreateClientConfig = (
+ override?: Config,
+) => Config & T>;
export const client = createClient(
- createConfig({
+ createConfig({
baseUrl: 'https://petstore3.swagger.io/api/v3',
}),
);
diff --git a/examples/openapi-ts-angular/src/client/client/client.gen.ts b/examples/openapi-ts-angular/src/client/client/client.gen.ts
index 93b77ace4..1555ca230 100644
--- a/examples/openapi-ts-angular/src/client/client/client.gen.ts
+++ b/examples/openapi-ts-angular/src/client/client/client.gen.ts
@@ -18,6 +18,7 @@ import { filter } from 'rxjs/operators';
import { createSseClient } from '../core/serverSentEvents.gen';
import type { HttpMethod } from '../core/types.gen';
+import { getValidRequestBody } from '../core/utils.gen';
import type {
Client,
Config,
@@ -69,7 +70,7 @@ export const createClient = (config: Config = {}): Client => {
...options,
headers: mergeHeaders(_config.headers, options.headers),
httpClient: options.httpClient ?? _config.httpClient,
- serializedBody: options.body as any,
+ serializedBody: undefined,
};
if (!opts.httpClient) {
@@ -83,12 +84,12 @@ export const createClient = (config: Config = {}): Client => {
}
}
- if (opts.body && opts.bodySerializer) {
+ if (opts.body !== undefined && opts.bodySerializer) {
opts.serializedBody = opts.bodySerializer(opts.body);
}
// remove Content-Type header if body is empty to avoid sending invalid requests
- if (opts.serializedBody === undefined || opts.serializedBody === '') {
+ if (opts.body === undefined || opts.serializedBody === '') {
opts.headers.delete('Content-Type');
}
@@ -97,7 +98,7 @@ export const createClient = (config: Config = {}): Client => {
const req = new HttpRequest(
opts.method ?? 'GET',
url,
- opts.serializedBody || null,
+ getValidRequestBody(opts),
{
redirect: 'follow',
...opts,
@@ -130,7 +131,7 @@ export const createClient = (config: Config = {}): Client => {
let req = initialReq;
- for (const fn of interceptors.request._fns) {
+ for (const fn of interceptors.request.fns) {
if (fn) {
req = await fn(req, opts as any);
}
@@ -151,7 +152,7 @@ export const createClient = (config: Config = {}): Client => {
.pipe(filter((event) => event.type === HttpEventType.Response)),
)) as HttpResponse;
- for (const fn of interceptors.response._fns) {
+ for (const fn of interceptors.response.fns) {
if (fn) {
result.response = await fn(result.response, req, opts as any);
}
@@ -177,7 +178,7 @@ export const createClient = (config: Config = {}): Client => {
let finalError = error instanceof HttpErrorResponse ? error.error : error;
- for (const fn of interceptors.error._fns) {
+ for (const fn of interceptors.error.fns) {
if (fn) {
finalError = (await fn(
finalError,
diff --git a/examples/openapi-ts-angular/src/client/client/index.ts b/examples/openapi-ts-angular/src/client/client/index.ts
index 318a84b6a..cbf8dfeed 100644
--- a/examples/openapi-ts-angular/src/client/client/index.ts
+++ b/examples/openapi-ts-angular/src/client/client/index.ts
@@ -8,6 +8,7 @@ export {
urlSearchParamsBodySerializer,
} from '../core/bodySerializer.gen';
export { buildClientParams } from '../core/params.gen';
+export { serializeQueryKeyValue } from '../core/queryKeySerializer.gen';
export { createClient } from './client.gen';
export type {
Client,
diff --git a/examples/openapi-ts-angular/src/client/client/utils.gen.ts b/examples/openapi-ts-angular/src/client/client/utils.gen.ts
index b90ad7e5e..64a5d8b09 100644
--- a/examples/openapi-ts-angular/src/client/client/utils.gen.ts
+++ b/examples/openapi-ts-angular/src/client/client/utils.gen.ts
@@ -345,67 +345,61 @@ type ResInterceptor = (
) => Res | Promise;
class Interceptors {
- _fns: (Interceptor | null)[];
+ fns: Array = [];
- constructor() {
- this._fns = [];
+ clear(): void {
+ this.fns = [];
}
- clear() {
- this._fns = [];
- }
-
- getInterceptorIndex(id: number | Interceptor): number {
- if (typeof id === 'number') {
- return this._fns[id] ? id : -1;
- } else {
- return this._fns.indexOf(id);
+ eject(id: number | Interceptor): void {
+ const index = this.getInterceptorIndex(id);
+ if (this.fns[index]) {
+ this.fns[index] = null;
}
}
- exists(id: number | Interceptor) {
+
+ exists(id: number | Interceptor): boolean {
const index = this.getInterceptorIndex(id);
- return !!this._fns[index];
+ return Boolean(this.fns[index]);
}
- eject(id: number | Interceptor) {
- const index = this.getInterceptorIndex(id);
- if (this._fns[index]) {
- this._fns[index] = null;
+ getInterceptorIndex(id: number | Interceptor): number {
+ if (typeof id === 'number') {
+ return this.fns[id] ? id : -1;
}
+ return this.fns.indexOf(id);
}
- update(id: number | Interceptor, fn: Interceptor) {
+ update(
+ id: number | Interceptor,
+ fn: Interceptor,
+ ): number | Interceptor | false {
const index = this.getInterceptorIndex(id);
- if (this._fns[index]) {
- this._fns[index] = fn;
+ if (this.fns[index]) {
+ this.fns[index] = fn;
return id;
- } else {
- return false;
}
+ return false;
}
- use(fn: Interceptor) {
- this._fns = [...this._fns, fn];
- return this._fns.length - 1;
+ use(fn: Interceptor): number {
+ this.fns.push(fn);
+ return this.fns.length - 1;
}
}
-// `createInterceptors()` response, meant for external use as it does not
-// expose internals
export interface Middleware {
- error: Pick<
- Interceptors>,
- 'eject' | 'use'
- >;
- request: Pick>, 'eject' | 'use'>;
- response: Pick<
- Interceptors>,
- 'eject' | 'use'
- >;
+ error: Interceptors>;
+ request: Interceptors>;
+ response: Interceptors>;
}
-// do not add `Middleware` as return type so we can use _fns internally
-export const createInterceptors = () => ({
+export const createInterceptors = (): Middleware<
+ Req,
+ Res,
+ Err,
+ Options
+> => ({
error: new Interceptors>(),
request: new Interceptors>(),
response: new Interceptors>(),
diff --git a/examples/openapi-ts-angular/src/client/core/queryKeySerializer.gen.ts b/examples/openapi-ts-angular/src/client/core/queryKeySerializer.gen.ts
new file mode 100644
index 000000000..d3bb68396
--- /dev/null
+++ b/examples/openapi-ts-angular/src/client/core/queryKeySerializer.gen.ts
@@ -0,0 +1,136 @@
+// This file is auto-generated by @hey-api/openapi-ts
+
+/**
+ * JSON-friendly union that mirrors what Pinia Colada can hash.
+ */
+export type JsonValue =
+ | null
+ | string
+ | number
+ | boolean
+ | JsonValue[]
+ | { [key: string]: JsonValue };
+
+/**
+ * Replacer that converts non-JSON values (bigint, Date, etc.) to safe substitutes.
+ */
+export const queryKeyJsonReplacer = (_key: string, value: unknown) => {
+ if (
+ value === undefined ||
+ typeof value === 'function' ||
+ typeof value === 'symbol'
+ ) {
+ return undefined;
+ }
+ if (typeof value === 'bigint') {
+ return value.toString();
+ }
+ if (value instanceof Date) {
+ return value.toISOString();
+ }
+ return value;
+};
+
+/**
+ * Safely stringifies a value and parses it back into a JsonValue.
+ */
+export const stringifyToJsonValue = (input: unknown): JsonValue | undefined => {
+ try {
+ const json = JSON.stringify(input, queryKeyJsonReplacer);
+ if (json === undefined) {
+ return undefined;
+ }
+ return JSON.parse(json) as JsonValue;
+ } catch {
+ return undefined;
+ }
+};
+
+/**
+ * Detects plain objects (including objects with a null prototype).
+ */
+const isPlainObject = (value: unknown): value is Record => {
+ if (value === null || typeof value !== 'object') {
+ return false;
+ }
+ const prototype = Object.getPrototypeOf(value as object);
+ return prototype === Object.prototype || prototype === null;
+};
+
+/**
+ * Turns URLSearchParams into a sorted JSON object for deterministic keys.
+ */
+const serializeSearchParams = (params: URLSearchParams): JsonValue => {
+ const entries = Array.from(params.entries()).sort(([a], [b]) =>
+ a.localeCompare(b),
+ );
+ const result: Record = {};
+
+ for (const [key, value] of entries) {
+ const existing = result[key];
+ if (existing === undefined) {
+ result[key] = value;
+ continue;
+ }
+
+ if (Array.isArray(existing)) {
+ (existing as string[]).push(value);
+ } else {
+ result[key] = [existing, value];
+ }
+ }
+
+ return result;
+};
+
+/**
+ * Normalizes any accepted value into a JSON-friendly shape for query keys.
+ */
+export const serializeQueryKeyValue = (
+ value: unknown,
+): JsonValue | undefined => {
+ if (value === null) {
+ return null;
+ }
+
+ if (
+ typeof value === 'string' ||
+ typeof value === 'number' ||
+ typeof value === 'boolean'
+ ) {
+ return value;
+ }
+
+ if (
+ value === undefined ||
+ typeof value === 'function' ||
+ typeof value === 'symbol'
+ ) {
+ return undefined;
+ }
+
+ if (typeof value === 'bigint') {
+ return value.toString();
+ }
+
+ if (value instanceof Date) {
+ return value.toISOString();
+ }
+
+ if (Array.isArray(value)) {
+ return stringifyToJsonValue(value);
+ }
+
+ if (
+ typeof URLSearchParams !== 'undefined' &&
+ value instanceof URLSearchParams
+ ) {
+ return serializeSearchParams(value);
+ }
+
+ if (isPlainObject(value)) {
+ return stringifyToJsonValue(value);
+ }
+
+ return undefined;
+};
diff --git a/examples/openapi-ts-angular/src/client/core/utils.gen.ts b/examples/openapi-ts-angular/src/client/core/utils.gen.ts
index ac31396fe..0b5389d08 100644
--- a/examples/openapi-ts-angular/src/client/core/utils.gen.ts
+++ b/examples/openapi-ts-angular/src/client/core/utils.gen.ts
@@ -1,6 +1,6 @@
// This file is auto-generated by @hey-api/openapi-ts
-import type { QuerySerializer } from './bodySerializer.gen';
+import type { BodySerializer, QuerySerializer } from './bodySerializer.gen';
import {
type ArraySeparatorStyle,
serializeArrayParam,
@@ -112,3 +112,32 @@ export const getUrl = ({
}
return url;
};
+
+export function getValidRequestBody(options: {
+ body?: unknown;
+ bodySerializer?: BodySerializer | null;
+ serializedBody?: unknown;
+}) {
+ const hasBody = options.body !== undefined;
+ const isSerializedBody = hasBody && options.bodySerializer;
+
+ if (isSerializedBody) {
+ if ('serializedBody' in options) {
+ const hasSerializedBody =
+ options.serializedBody !== undefined && options.serializedBody !== '';
+
+ return hasSerializedBody ? options.serializedBody : null;
+ }
+
+ // not all clients implement a serializedBody property (i.e. client-axios)
+ return options.body !== '' ? options.body : null;
+ }
+
+ // plain/text body
+ if (hasBody) {
+ return options.body;
+ }
+
+ // no body was provided
+ return undefined;
+}
diff --git a/examples/openapi-ts-angular/src/client/index.ts b/examples/openapi-ts-angular/src/client/index.ts
index 688e3c912..57ed02bf5 100644
--- a/examples/openapi-ts-angular/src/client/index.ts
+++ b/examples/openapi-ts-angular/src/client/index.ts
@@ -1,3 +1,4 @@
// This file is auto-generated by @hey-api/openapi-ts
+
export * from './sdk.gen';
-export * from './types.gen';
+export type * from './types.gen';
diff --git a/examples/openapi-ts-angular/src/client/sdk.gen.ts b/examples/openapi-ts-angular/src/client/sdk.gen.ts
index 2c40f5893..9d7d0b4e5 100644
--- a/examples/openapi-ts-angular/src/client/sdk.gen.ts
+++ b/examples/openapi-ts-angular/src/client/sdk.gen.ts
@@ -2,8 +2,8 @@
import { Injectable } from '@angular/core';
-import type { Client, Options as ClientOptions, TDataShape } from './client';
-import { client as _heyApiClient } from './client.gen';
+import type { Client, Options as Options2, TDataShape } from './client';
+import { client } from './client.gen';
import type {
AddPetData,
AddPetErrors,
@@ -67,7 +67,7 @@ import type {
export type Options<
TData extends TDataShape = TDataShape,
ThrowOnError extends boolean = boolean,
-> = ClientOptions & {
+> = Options2 & {
/**
* You can provide a client instance returned by `createClient()` instead of
* individual options. This might be also useful if you want to implement a
@@ -87,12 +87,13 @@ export type Options<
export class PetService {
/**
* Add a new pet to the store.
+ *
* Add a new pet to the store.
*/
public addPet(
options: Options,
) {
- return (options.client ?? _heyApiClient).post<
+ return (options.client ?? client).post<
AddPetResponses,
AddPetErrors,
ThrowOnError
@@ -114,12 +115,13 @@ export class PetService {
/**
* Update an existing pet.
+ *
* Update an existing pet by Id.
*/
public updatePet(
options: Options,
) {
- return (options.client ?? _heyApiClient).put<
+ return (options.client ?? client).put<
UpdatePetResponses,
UpdatePetErrors,
ThrowOnError
@@ -141,12 +143,13 @@ export class PetService {
/**
* Finds Pets by status.
+ *
* Multiple status values can be provided with comma separated strings.
*/
public findPetsByStatus(
options: Options,
) {
- return (options.client ?? _heyApiClient).get<
+ return (options.client ?? client).get<
FindPetsByStatusResponses,
FindPetsByStatusErrors,
ThrowOnError
@@ -164,12 +167,13 @@ export class PetService {
/**
* Finds Pets by tags.
+ *
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
*/
public findPetsByTags(
options: Options