Skip to content

Commit 94cb2aa

Browse files
committed
Merge branch 'main' of https://github.com/hey-api/openapi-ts into feat/msw-plugin
2 parents b5fce36 + 8d3167c commit 94cb2aa

25 files changed

Lines changed: 2005 additions & 56 deletions

File tree

.changeset/mean-tips-care.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@hey-api/openapi-ts": patch
3+
---
4+
5+
**cli**: improve error message on invalid input

.changeset/pink-rivers-sniff.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@hey-api/openapi-ts": patch
3+
---
4+
5+
**plugin(@angular/common)**: fix: requests and resources broken default configuration

.changeset/rude-glasses-prove.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@hey-api/shared": patch
3+
---
4+
5+
**error**: handle InputError

.changeset/seven-doors-learn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@hey-api/json-schema-ref-parser": patch
3+
---
4+
5+
**internal**: export errors

docs/.vitepress/config/en.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ export default defineConfig({
4444
link: '/openapi-ts/configuration/parser',
4545
text: 'Parser',
4646
},
47+
{
48+
link: '/openapi-ts/configuration/vite',
49+
text: 'Vite',
50+
},
4751
],
4852
link: '/openapi-ts/configuration',
4953
text: 'Configuration',

docs/openapi-ts/clients/nuxt.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Start by adding `@hey-api/nuxt` to your dependencies.
4141
::: code-group
4242

4343
```sh [npm]
44-
npm install @hey-api/nuxt
44+
npm add @hey-api/nuxt
4545
```
4646

4747
```sh [pnpm]
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
---
2+
title: Vite Plugin
3+
description: Integrate @hey-api/openapi-ts into your Vite build pipeline with the official Vite plugin.
4+
---
5+
6+
# Vite
7+
8+
### About
9+
10+
[Vite](https://vite.dev) is a blazing fast frontend build tool powering the next generation of web applications.
11+
12+
The Vite plugin integrates `@hey-api/openapi-ts` into the Vite build pipeline, running automatically whenever Vite resolves its configuration – no separate script or manual step required.
13+
14+
## Features
15+
16+
- runs automatically as part of your Vite build
17+
- reads your existing [configuration](/openapi-ts/get-started) (or accepts inline config)
18+
- works with any Vite-based project
19+
20+
## Installation
21+
22+
You can download `@hey-api/vite-plugin` from npm using your favorite package manager.
23+
24+
::: code-group
25+
26+
```sh [npm]
27+
npm add @hey-api/vite-plugin -D -E
28+
```
29+
30+
```sh [pnpm]
31+
pnpm add @hey-api/vite-plugin -D -E
32+
```
33+
34+
```sh [yarn]
35+
yarn add @hey-api/vite-plugin -D -E
36+
```
37+
38+
```sh [bun]
39+
bun add @hey-api/vite-plugin -D -E
40+
```
41+
42+
:::
43+
44+
## Usage
45+
46+
Add the plugin to your `vite.config.ts`:
47+
48+
::: code-group
49+
50+
```ts [vite.config.ts]
51+
import { heyApiPlugin } from '@hey-api/vite-plugin';
52+
import { defineConfig } from 'vite';
53+
54+
export default defineConfig({
55+
plugins: [heyApiPlugin()],
56+
});
57+
```
58+
59+
:::
60+
61+
The plugin will automatically pick up your [configuration](/openapi-ts/configuration) file. You can also pass options inline using the `config` option:
62+
63+
::: code-group
64+
65+
```ts [vite.config.ts]
66+
import { heyApiPlugin } from '@hey-api/vite-plugin';
67+
import { defineConfig } from 'vite';
68+
69+
export default defineConfig({
70+
plugins: [
71+
heyApiPlugin({
72+
config: {
73+
input: 'hey-api/backend', // sign up at app.heyapi.dev
74+
output: 'src/client',
75+
},
76+
}),
77+
],
78+
});
79+
```
80+
81+
:::
82+
83+
<!--@include: ../../partials/examples.md-->
84+
<!--@include: ../../partials/sponsors.md-->

docs/openapi-ts/get-started.md

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ You can download `@hey-api/openapi-ts` from npm using your favorite package mana
5151
::: code-group
5252

5353
```sh [npm]
54-
npm install @hey-api/openapi-ts -D -E
54+
npm add @hey-api/openapi-ts -D -E
5555
```
5656

5757
```sh [pnpm]
@@ -105,6 +105,54 @@ createClient({
105105

106106
:::
107107

108+
### Vite
109+
110+
If you're using [Vite](https://vite.dev), you can integrate `@hey-api/openapi-ts` directly into your build pipeline with `@hey-api/vite-plugin`. Install it alongside the main package:
111+
112+
::: code-group
113+
114+
```sh [npm]
115+
npm add @hey-api/vite-plugin -D -E
116+
```
117+
118+
```sh [pnpm]
119+
pnpm add @hey-api/vite-plugin -D -E
120+
```
121+
122+
```sh [yarn]
123+
yarn add @hey-api/vite-plugin -D -E
124+
```
125+
126+
```sh [bun]
127+
bun add @hey-api/vite-plugin -D -E
128+
```
129+
130+
:::
131+
132+
Then add the plugin to your Vite configuration:
133+
134+
::: code-group
135+
136+
```ts [vite.config.ts]
137+
import { heyApiPlugin } from '@hey-api/vite-plugin';
138+
import { defineConfig } from 'vite';
139+
140+
export default defineConfig({
141+
plugins: [
142+
heyApiPlugin({
143+
config: {
144+
input: 'hey-api/backend', // sign up at app.heyapi.dev
145+
output: 'src/client',
146+
},
147+
}),
148+
],
149+
});
150+
```
151+
152+
:::
153+
154+
See the [Vite](/openapi-ts/configuration/vite) page for full configuration options.
155+
108156
### Configuration
109157

110158
It's a good practice to extract your configuration into a separate file. Learn how to do that and discover available options on the [Configuration](/openapi-ts/configuration) page.

docs/openapi-ts/migrating.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ If you need to access individual fields, you can do so using the [`.shape`](http
479479
480480
### Bundle `@hey-api/client-*` plugins
481481
482-
In previous releases, you had to install a separate client package to generate a fully working output, e.g., `npm install @hey-api/client-fetch`. This created a few challenges: getting started was slower, upgrading was sometimes painful, and bundling too. Beginning with v0.73.0, all Hey API clients are bundled by default and don't require installing any additional dependencies. You can remove any installed client packages and re-run `@hey-api/openapi-ts`.
482+
In previous releases, you had to install a separate client package to generate a fully working output, e.g., `npm add @hey-api/client-fetch`. This created a few challenges: getting started was slower, upgrading was sometimes painful, and bundling too. Beginning with v0.73.0, all Hey API clients are bundled by default and don't require installing any additional dependencies. You can remove any installed client packages and re-run `@hey-api/openapi-ts`.
483483
484484
```sh
485485
npm uninstall @hey-api/client-fetch

docs/openapi-ts/plugins/sdk.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ export default {
540540
541541
### Display
542542
543-
Enabling examples does not produce visible output on its own. Examples are written into the source specification and can be consumed by documentation tools such as [Mintlify](https://kutt.to/6vrYy9) or [Scalar](https://kutt.to/skQUVd). To persist that specification, enable [Source](/openapi-ts/configuration/output#source) generation.
543+
Enabling examples does not produce visible output on its own. Examples are written into the source specification and can be consumed by documentation tools such as [Scalar](https://kutt.to/skQUVd). To persist that specification, enable [Source](/openapi-ts/configuration/output#source) generation.
544544
545545
## API
546546

0 commit comments

Comments
 (0)