Skip to content

Commit a4acb37

Browse files
committed
Merge branch 'main' into refactor/2597
2 parents 87d5004 + f99690b commit a4acb37

File tree

1,395 files changed

+16047
-15278
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,395 files changed

+16047
-15278
lines changed

.changeset/fix-zod-union-deduplication.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141

4242
- name: Generate GitHub App Token
4343
id: app-token
44-
uses: actions/[email protected].1
44+
uses: actions/[email protected].4
4545
with:
4646
app-id: ${{ secrets.GIT_APP_CLIENT_ID }}
4747
private-key: ${{ secrets.GIT_APP_PRIVATE_KEY }}

docs/.vitepress/config/en.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ export default defineConfig({
258258
text: 'Custom',
259259
},
260260
],
261-
text: 'Guides and Concepts',
261+
text: 'Plugins',
262262
},
263263
{
264264
items: [

docs/openapi-ts/configuration/output.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,78 @@ export default {
3434

3535
:::
3636

37+
## File Name
38+
39+
You can customize the naming and casing pattern for files using the `fileName` option.
40+
41+
::: code-group
42+
43+
```js [default]
44+
export default {
45+
input: 'hey-api/backend', // sign up at app.heyapi.dev
46+
output: {
47+
fileName: '{{name}}', // [!code ++]
48+
path: 'src/client',
49+
},
50+
};
51+
```
52+
53+
```js [snake_case]
54+
export default {
55+
input: 'hey-api/backend', // sign up at app.heyapi.dev
56+
output: {
57+
fileName: {
58+
case: 'snake_case', // [!code ++]
59+
},
60+
path: 'src/client',
61+
},
62+
};
63+
```
64+
65+
:::
66+
67+
By default, we append every file name with a `.gen` suffix to highlight it's automatically generated. You can customize or disable this suffix using the `fileName.suffix` option.
68+
69+
::: code-group
70+
71+
```js [default]
72+
export default {
73+
input: 'hey-api/backend', // sign up at app.heyapi.dev
74+
output: {
75+
fileName: {
76+
suffix: '.gen', // [!code ++]
77+
},
78+
path: 'src/client',
79+
},
80+
};
81+
```
82+
83+
```js [off]
84+
export default {
85+
input: 'hey-api/backend', // sign up at app.heyapi.dev
86+
output: {
87+
fileName: {
88+
suffix: null, // [!code ++]
89+
},
90+
path: 'src/client',
91+
},
92+
};
93+
```
94+
95+
```js [custom]
96+
export default {
97+
input: 'hey-api/backend', // sign up at app.heyapi.dev
98+
output: {
99+
fileName: {
100+
suffix: '.generated', // [!code ++]
101+
},
102+
path: 'src/client',
103+
},
104+
};
105+
```
106+
107+
:::
108+
37109
## Format
38110

39111
To format your output folder contents, set `output.format` to a valid formatter.

docs/openapi-ts/configuration/parser.md

Lines changed: 71 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,36 @@ export default {
460460

461461
## Hooks
462462

463-
Hooks affect runtime behavior but aren’t tied to any single plugin. They can be configured globally via `parser.hooks` or per plugin through the `~hooks` property.
463+
Hooks affect runtime behavior but aren’t tied to any single plugin. They can be configured globally via `hooks` or per plugin through the `~hooks` property.
464+
465+
::: code-group
466+
467+
```js [parser]
468+
export default {
469+
input: 'hey-api/backend', // sign up at app.heyapi.dev
470+
output: 'src/client',
471+
parser: {
472+
hooks: {}, // configure global hooks here // [!code ++]
473+
},
474+
};
475+
```
476+
477+
```js [plugin]
478+
export default {
479+
input: 'hey-api/backend', // sign up at app.heyapi.dev
480+
output: 'src/client',
481+
plugins: [
482+
{
483+
name: '@tanstack/react-query',
484+
'~hooks': {}, // configure plugin hooks here // [!code ++]
485+
},
486+
],
487+
};
488+
```
489+
490+
:::
491+
492+
We always use the first hook that returns a value. If a hook returns no value, we fall back to less specific hooks until one does.
464493

465494
### Operations {#hooks-operations}
466495

@@ -478,12 +507,12 @@ By default, DELETE, PATCH, POST, and PUT operations are classified as `mutation`
478507

479508
Imagine your API has a POST `/search` endpoint that accepts a large payload. By default, it's classified as a `mutation`, but in practice it behaves like a `query`, and your [state management](/openapi-ts/state-management) plugin should generate query hooks.
480509

481-
You can fix this by classifying the operation as `query` in a matcher. If a matcher returns no value, we fall back to less specific matchers until one does.
510+
You can achieve this by classifying the operation as `query` in a matcher.
482511

483512
::: code-group
484513

485514
<!-- prettier-ignore-start -->
486-
```js [parser]
515+
```js [isQuery]
487516
export default {
488517
input: 'hey-api/backend', // sign up at app.heyapi.dev
489518
output: 'src/client',
@@ -502,29 +531,56 @@ export default {
502531
```
503532
<!-- prettier-ignore-end -->
504533
<!-- prettier-ignore-start -->
505-
```js [plugin]
534+
```js [getKind]
506535
export default {
507536
input: 'hey-api/backend', // sign up at app.heyapi.dev
508537
output: 'src/client',
509-
plugins: [
510-
{
511-
name: '@tanstack/react-query',
512-
'~hooks': {
513-
operations: {
514-
getKind: (op) => {
515-
if (op.method === 'post' && op.path === '/search') { // [!code ++]
516-
return ['query']; // [!code ++]
517-
} // [!code ++]
518-
},
538+
parser: {
539+
hooks: {
540+
operations: {
541+
getKind: (op) => {
542+
if (op.method === 'post' && op.path === '/search') { // [!code ++]
543+
return ['query']; // [!code ++]
544+
} // [!code ++]
519545
},
520546
},
521547
},
522-
],
548+
},
523549
};
524550
```
525551
<!-- prettier-ignore-end -->
526552

527553
:::
528554

555+
### Symbols {#hooks-symbols}
556+
557+
Each symbol can have a placement function deciding its output location.
558+
559+
#### Example: Alphabetic sort
560+
561+
While we work on a better example, let's imagine a world where it's desirable to place every symbol in a file named after its initial letter. For example, a function named `Foo` should end up in the file `f.ts`.
562+
563+
You can achieve this by using the symbol's name.
564+
565+
<!-- prettier-ignore-start -->
566+
```js [getKind]
567+
export default {
568+
input: 'hey-api/backend', // sign up at app.heyapi.dev
569+
output: 'src/client',
570+
parser: {
571+
hooks: {
572+
symbols: {
573+
getFilePath: (symbol) => {
574+
if (symbol.name) { // [!code ++]
575+
return symbol.name[0]?.toLowerCase(); // [!code ++]
576+
} // [!code ++]
577+
},
578+
},
579+
},
580+
},
581+
};
582+
```
583+
<!-- prettier-ignore-end -->
584+
529585
<!--@include: ../../partials/examples.md-->
530586
<!--@include: ../../partials/sponsors.md-->

docs/openapi-ts/get-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Launch demo
2121

2222
- runs in CLI, Node.js 18+, or npx
2323
- works with OpenAPI 2.0, 3.0, and 3.1
24-
- customizable types and SDKs
24+
- core plugins for types, SDKs, and schemas
2525
- clients for your runtime (Fetch API, Angular, Axios, Next.js, Nuxt, etc.)
2626
- plugin ecosystem to reduce third-party boilerplate
2727
- custom plugins and custom clients

docs/openapi-ts/migrating.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,22 @@ description: Migrating to @hey-api/openapi-ts.
77

88
While we try to avoid breaking changes, sometimes it's unavoidable in order to offer you the latest features. This page lists changes that require updates to your code. If you run into a problem with migration, please [open an issue](https://github.com/hey-api/openapi-ts/issues).
99

10+
## v0.84.0
11+
12+
### Symbol API
13+
14+
This release improves the Symbol API, which adds the capability to place symbols in arbitrary files. We preserved the previous output structure for all plugins except Angular.
15+
16+
You can preserve the previous Angular output by writing your own [placement function](/openapi-ts/configuration/parser#hooks-symbols).
17+
18+
### TypeScript renderer
19+
20+
We ship a dedicated TypeScript renderer for `.ts` files. This release improves the renderer's ability to group and sort imported modules, resulting in a more polished output.
21+
22+
### Removed `output` plugin option
23+
24+
Due to the Symbol API release, this option has been removed from the Plugin API.
25+
1026
## v0.83.0
1127

1228
### Symbol API

docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@
2020
"vitepress-plugin-llms": "1.7.3",
2121
"vue": "3.5.13"
2222
},
23-
"packageManager": "pnpm@10.15.0"
23+
"packageManager": "pnpm@10.17.0"
2424
}

docs/partials/contributors-list.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,16 @@
7575
- [carson](https://github.com/carson2222)
7676
- [johnny kim](https://github.com/johnny-mh)
7777
- [0xfurai](https://github.com/0xfurai)
78+
- [Ben-Pfirsich](https://github.com/Ben-Pfirsich)
79+
- [Copilot](https://github.com/Copilot)
7880
- [Mxwllas](https://github.com/Mxwllas)
7981
- [RndUsername](https://github.com/RndUsername)
8082
- [Schroedi](https://github.com/Schroedi)
8183
- [alexedme](https://github.com/alexedme)
84+
- [ben-pietsch](https://github.com/ben-pietsch)
8285
- [fml09](https://github.com/fml09)
8386
- [henry-encord](https://github.com/henry-encord)
8487
- [hunshcn](https://github.com/hunshcn)
8588
- [maxdew-envelio](https://github.com/maxdew-envelio)
8689
- [nnzhadow](https://github.com/nnzhadow)
90+
- [renovate[bot]](https://github.com/renovate[bot])

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,5 @@
7070
"typescript-eslint": "8.29.1",
7171
"vitest": "3.1.1"
7272
},
73-
"packageManager": "pnpm@10.15.1"
73+
"packageManager": "pnpm@10.17.0"
7474
}

0 commit comments

Comments
 (0)