Skip to content

Commit 465410c

Browse files
committed
feat: change the default parser
1 parent f5e5fca commit 465410c

File tree

66 files changed

+10060
-7400
lines changed

Some content is hidden

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

66 files changed

+10060
-7400
lines changed

.changeset/shaggy-otters-vanish.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
'@example/openapi-ts-fastify': minor
3+
'@hey-api/client-axios': minor
4+
'@hey-api/client-fetch': minor
5+
'@hey-api/openapi-ts': minor
6+
'@hey-api/docs': minor
7+
---
8+
9+
feat: change the default parser

README.md

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -178,35 +178,6 @@ Clients are responsible for sending the actual HTTP requests. The `client` value
178178

179179
You can learn more on the [Clients](https://heyapi.dev/openapi-ts/clients) page.
180180

181-
### Parser
182-
183-
If you're NOT using a legacy client, we encourage you to try out the experimental parser. Soon, it will become the default parser, but until it's been tested it's an opt-in feature. To try it out, set the `experimentalParser` flag in your configuration to `true`.
184-
185-
#### config
186-
187-
```js
188-
export default {
189-
client: '@hey-api/client-fetch',
190-
experimentalParser: true,
191-
input: 'path/to/openapi.json',
192-
output: 'src/client',
193-
};
194-
```
195-
196-
#### cli
197-
198-
```sh
199-
npx @hey-api/openapi-ts \
200-
-c @hey-api/client-fetch \
201-
-e \
202-
-i path/to/openapi.json \
203-
-o src/client
204-
```
205-
206-
The experimental parser produces a cleaner output while being faster than the legacy parser. It also supports features such as [Filters](https://heyapi.dev/openapi-ts/configuration#filters) and more are being added.
207-
208-
The legacy parser will be used with the [legacy clients](https://heyapi.dev/openapi-ts/clients/legacy) regardless of the `experimentalParser` flag value. However, it's unlikely to receive any further updates.
209-
210181
## Plugins
211182

212183
Plugins are responsible for generating artifacts from your input. By default, Hey API will generate TypeScript interfaces and SDK from your OpenAPI specification. You can add, remove, or customize any of the plugins. In fact, we highly encourage you to do so!

docs/openapi-ts/clients/axios.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,6 @@ const response = await getFoo({
151151

152152
## Auth
153153

154-
::: warning
155-
To use this feature, you must opt in to the [experimental parser](/openapi-ts/configuration#parser).
156-
:::
157-
158154
The SDKs include auth mechanisms for every endpoint. You will want to configure the `auth` field to pass the right token for each request. The `auth` field can be a string or a function returning a string representing the token. The returned value will be attached only to requests that require auth.
159155

160156
```js
@@ -179,10 +175,6 @@ client.instance.interceptors.request.use((config) => {
179175

180176
## Build URL
181177

182-
::: warning
183-
To use this feature, you must opt in to the [experimental parser](/openapi-ts/configuration#parser).
184-
:::
185-
186178
If you need to access the compiled URL, you can use the `buildUrl()` method. It's loosely typed by default to accept almost any value; in practice, you will want to pass a type hint.
187179

188180
```ts

docs/openapi-ts/clients/fetch.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,6 @@ const response = await getFoo({
190190

191191
## Auth
192192

193-
::: warning
194-
To use this feature, you must opt in to the [experimental parser](/openapi-ts/configuration#parser).
195-
:::
196-
197193
The SDKs include auth mechanisms for every endpoint. You will want to configure the `auth` field to pass the right token for each request. The `auth` field can be a string or a function returning a string representing the token. The returned value will be attached only to requests that require auth.
198194

199195
```js
@@ -218,10 +214,6 @@ client.interceptors.request.use((request, options) => {
218214

219215
## Build URL
220216

221-
::: warning
222-
To use this feature, you must opt in to the [experimental parser](/openapi-ts/configuration#parser).
223-
:::
224-
225217
If you need to access the compiled URL, you can use the `buildUrl()` method. It's loosely typed by default to accept almost any value; in practice, you will want to pass a type hint.
226218

227219
```ts

docs/openapi-ts/configuration.md

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -94,35 +94,6 @@ Plugins are responsible for generating artifacts from your input. By default, He
9494

9595
You can learn more on the [Output](/openapi-ts/output) page.
9696

97-
## Parser
98-
99-
If you're NOT using a legacy client, we encourage you to try out the experimental parser. Soon, it will become the default parser, but until it's been tested it's an opt-in feature. To try it out, set the `experimentalParser` flag in your configuration to `true`.
100-
101-
::: code-group
102-
103-
```js [config]
104-
export default {
105-
client: '@hey-api/client-fetch',
106-
experimentalParser: true, // [!code ++]
107-
input: 'path/to/openapi.json',
108-
output: 'src/client',
109-
};
110-
```
111-
112-
```sh [cli]
113-
npx @hey-api/openapi-ts \
114-
-c @hey-api/client-fetch \
115-
-e \ # [!code ++]
116-
-i path/to/openapi.json \
117-
-o src/client
118-
```
119-
120-
:::
121-
122-
The experimental parser produces a cleaner output while being faster than the legacy parser. It also supports features such as [Filters](#filters) and more are being added.
123-
124-
The legacy parser will be used with the [legacy clients](/openapi-ts/clients/legacy) regardless of the `experimentalParser` flag value. However, it's unlikely to receive any further updates.
125-
12697
## Formatting
12798

12899
To format your output folder contents, set `output.format` to a valid formatter.
@@ -222,18 +193,13 @@ You can also prevent your output from being linted by adding your output path to
222193

223194
## Filters
224195

225-
::: warning
226-
To use this feature, you must opt in to the [experimental parser](#parser).
227-
:::
228-
229196
If you work with large specifications and want to generate output from their subset, you can use regular expressions to select the relevant definitions. Set `input.include` to match resource references to be included or `input.exclude` to match resource references to be excluded. When both regular expressions match the same definition, `input.exclude` takes precedence over `input.include`.
230197

231198
::: code-group
232199

233200
```js [include]
234201
export default {
235202
client: '@hey-api/client-fetch',
236-
experimentalParser: true, // [!code ++]
237203
input: {
238204
// match only the schema named `foo` and `GET` operation for the `/api/v1/foo` path // [!code ++]
239205
include: '^(#/components/schemas/foo|#/paths/api/v1/foo/get)$', // [!code ++]
@@ -246,7 +212,6 @@ export default {
246212
```js [exclude]
247213
export default {
248214
client: '@hey-api/client-fetch',
249-
experimentalParser: true, // [!code ++]
250215
input: {
251216
// match everything except for the schema named `foo` and `GET` operation for the `/api/v1/foo` path // [!code ++]
252217
exclude: '^(#/components/schemas/foo|#/paths/api/v1/foo/get)$', // [!code ++]

docs/openapi-ts/custom-plugin.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,6 @@ Re-exporting your plugin from `index.ts` may result in broken output due to nami
9999

100100
## Handler
101101

102-
::: warning
103-
To use this feature, you must opt in to the [experimental parser](/openapi-ts/configuration#parser).
104-
:::
105-
106102
Notice we defined `_handler` in our `config.ts` file. This method is responsible for generating the actual output. We recommend implementing it in `plugin.ts`.
107103

108104
::: code-group

docs/openapi-ts/migrating.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,23 @@ This config option is deprecated and will be removed in favor of [clients](./cli
2727

2828
This config option is deprecated and will be removed.
2929

30+
## v0.62.0
31+
32+
### Changed parser
33+
34+
Formerly known as the experimental parser, this is now the default parser. This change should not impact the generated output's functionality. However, there might be cases where this results in breaking changes due to different handling of certain scenarios. If you need to revert to the legacy parser, set the `experimentalParser` flag to `false`.
35+
36+
```js
37+
export default {
38+
client: '@hey-api/client-fetch',
39+
experimentalParser: false, // [!code ++]
40+
input: 'path/to/openapi.json',
41+
output: 'src/client',
42+
};
43+
```
44+
45+
Note that the legacy parser is no longer supported and will be removed in the v1 release.
46+
3047
## v0.61.0
3148

3249
### Added `auth` option

docs/openapi-ts/plugins/fastify.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,13 @@ Live demo
2323

2424
## Installation
2525

26-
::: warning
27-
To use this feature, you must opt in to the [experimental parser](/openapi-ts/configuration#parser).
28-
:::
29-
3026
In your [configuration](/openapi-ts/get-started), add `fastify` to your plugins and you'll be ready to generate Fastify artifacts. :tada:
3127

3228
```js
3329
import { defaultPlugins } from '@hey-api/openapi-ts';
3430

3531
export default {
3632
client: '@hey-api/client-fetch',
37-
experimentalParser: true, // [!code ++]
3833
input: 'path/to/openapi.json',
3934
output: 'src/client',
4035
plugins: [

docs/openapi-ts/plugins/zod.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,13 @@ Live demo
2222

2323
## Installation
2424

25-
::: warning
26-
To use this feature, you must opt in to the [experimental parser](/openapi-ts/configuration#parser).
27-
:::
28-
2925
In your [configuration](/openapi-ts/get-started), add `zod` to your plugins and you'll be ready to generate Zod artifacts. :tada:
3026

3127
```js
3228
import { defaultPlugins } from '@hey-api/openapi-ts';
3329

3430
export default {
3531
client: '@hey-api/client-fetch',
36-
experimentalParser: true, // [!code ++]
3732
input: 'path/to/openapi.json',
3833
output: 'src/client',
3934
plugins: [

examples/openapi-ts-fastify/openapi-ts.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { defineConfig } from '@hey-api/openapi-ts';
22

33
export default defineConfig({
44
client: '@hey-api/client-fetch',
5-
experimentalParser: true,
65
input:
76
'https://gist.githubusercontent.com/seriousme/55bd4c8ba2e598e416bb5543dcd362dc/raw/cf0b86ba37bb54bf1a6bf047c0ecf2a0ce4c62e0/petstore-v3.1.json',
87
output: {

0 commit comments

Comments
 (0)