Skip to content

Commit 771d762

Browse files
authored
Merge pull request #978 from hey-api/docs/tanstack-query-plugin
docs: add basic TanStack Query plugin description
2 parents 26f2b68 + 2e051a5 commit 771d762

File tree

18 files changed

+825
-798
lines changed

18 files changed

+825
-798
lines changed

.changeset/ten-mice-switch.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'@example/openapi-ts-tanstack-svelte-query': patch
3+
'@example/openapi-ts-tanstack-react-query': patch
4+
'@example/openapi-ts-tanstack-vue-query': patch
5+
'@hey-api/docs': patch
6+
---
7+
8+
docs: add basic TanStack Query plugin description

docs/.vitepress/config/en.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export default defineConfig({
4848
},
4949
{
5050
link: '/openapi-ts/tanstack-query',
51-
text: 'TanStack Query <span class="soon">soon</span>',
51+
text: 'TanStack Query',
5252
},
5353
],
5454
text: 'Plugins',

docs/embed.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ export const embedProject = (projectId: string) => async (event: Event) => {
2525
'openapi-ts.config.ts,src/client/schemas.gen.ts,src/client/services.gen.ts,src/client/types.gen.ts,src/App.tsx',
2626
view: 'editor',
2727
});
28+
case 'hey-api-client-fetch-plugin-tanstack-react-query-example':
29+
return await sdk.embedProjectId(container, projectId, {
30+
height: 700,
31+
openFile:
32+
'openapi-ts.config.ts,src/client/@tanstack/react-query.gen.ts,src/client/types.gen.ts,src/App.tsx',
33+
view: 'editor',
34+
});
2835
case 'hey-api-example':
2936
return await sdk.embedProjectId(container, projectId, {
3037
height: 700,

docs/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ features:
4242
link: /openapi-ts/integrations
4343
linkText: Find out more
4444
- icon: <svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 190 190"><g fill="none" fill-rule="evenodd"><path d="M150.276 61.344c3.093-14.981 3.756-26.471 1.757-34.815-1.189-4.962-3.362-9.01-6.668-11.93-3.49-3.084-7.901-4.597-12.858-4.597-8.178 0-16.775 3.725-25.963 10.802-3.747 2.887-7.636 6.366-11.676 10.44a8.743 8.743 0 0 0-1.09-1.163C82.36 19.915 72.746 13.599 64.523 11.164c-4.89-1.448-9.48-1.586-13.66-.181-4.414 1.483-7.93 4.55-10.41 8.845-4.094 7.089-5.174 16.403-3.648 27.904.623 4.688 1.686 9.794 3.189 15.327a8.725 8.725 0 0 0-1.698.38c-14.489 4.797-24.749 9.955-30.96 15.85-3.696 3.506-6.109 7.41-6.981 11.733-.921 4.562-.023 9.137 2.454 13.43 4.087 7.078 11.6 12.66 22.304 17.082 4.298 1.776 9.161 3.384 14.595 4.83a8.735 8.735 0 0 0-.57 1.776c-3.092 14.98-3.756 26.47-1.756 34.814 1.188 4.962 3.362 9.01 6.667 11.93 3.49 3.084 7.902 4.597 12.86 4.597 8.177 0 16.774-3.725 25.962-10.802 3.787-2.917 7.72-6.44 11.805-10.57.42.656.936 1.267 1.546 1.81 11.42 10.166 21.034 16.482 29.257 18.917 4.89 1.448 9.48 1.586 13.66.181 4.414-1.483 7.93-4.55 10.41-8.845 4.094-7.089 5.174-16.403 3.648-27.904-.645-4.857-1.764-10.164-3.354-15.929a8.715 8.715 0 0 0 1.863-.398c14.489-4.797 24.749-9.955 30.96-15.85 3.696-3.506 6.109-7.41 6.981-11.733.921-4.562.023-9.137-2.454-13.43-4.087-7.078-11.6-12.66-22.304-17.082-4.427-1.828-9.452-3.48-15.082-4.959.2-.49.36-1.006.47-1.543Z" fill="#002C4B" fill-rule="nonzero"/><path d="M80.397 64h29.211a5 5 0 0 1 4.337 2.512l14.632 25.5a5 5 0 0 1 0 4.976l-14.632 25.5a5 5 0 0 1-4.337 2.512H80.397a5 5 0 0 1-4.337-2.512l-14.632-25.5a5 5 0 0 1 0-4.976l14.632-25.5A5 5 0 0 1 80.397 64Zm25.59 6.277a5 5 0 0 1 4.339 2.513l11.017 19.224a5 5 0 0 1 0 4.972l-11.017 19.224a5 5 0 0 1-4.338 2.513h-21.97a5 5 0 0 1-4.339-2.513L68.662 96.986a5 5 0 0 1 0-4.972L79.679 72.79a5 5 0 0 1 4.338-2.513h21.97Zm-3.906 6.864H87.924a5 5 0 0 0-4.335 2.51l-7.1 12.358a5 5 0 0 0 0 4.982l7.1 12.358a5 5 0 0 0 4.335 2.51h14.157a5 5 0 0 0 4.335-2.51l7.1-12.358a5 5 0 0 0 0-4.982l-7.1-12.358a5 5 0 0 0-4.335-2.51Zm-3.762 6.571a5 5 0 0 1 4.334 2.506l3.33 5.788a5 5 0 0 1 0 4.988l-3.33 5.788a5 5 0 0 1-4.334 2.506h-6.633a5 5 0 0 1-4.334-2.506l-3.33-5.788a5 5 0 0 1 0-4.988l3.33-5.788a5 5 0 0 1 4.334-2.506h6.633Zm-3.315 6.473a4.313 4.313 0 1 0-.003 8.63 4.313 4.313 0 1 0 .003-8.63ZM60 94.5h7.768" fill="#FFD94C"/><path d="M54.86 108.358a2.713 2.713 0 0 1 3.718 1.041l.475.845a269.421 269.421 0 0 0 11.888 19.191c4.867 7.15 10.34 14.39 16.421 21.716a2.776 2.776 0 0 1-.296 3.847l-.612.537c-20.107 17.568-33.176 21.078-39.206 10.527-5.898-10.32-3.764-29.08 6.403-56.28a2.748 2.748 0 0 1 1.21-1.424Zm85.674 20.684a2.708 2.708 0 0 1 3.126 2.152l.153.792c4.97 26.01 1.47 39.014-10.497 39.014-11.706 0-26.607-11.091-44.703-33.273a2.725 2.725 0 0 1-.613-1.745 2.712 2.712 0 0 1 2.73-2.694l.955.007c7.62.041 15.03-.223 22.226-.794 8.498-.673 17.373-1.826 26.623-3.46Zm6.875-55.23c.523-1.41 2.1-2.149 3.546-1.663l.788.266c25.84 8.803 35.66 18.477 29.455 29.022-6.068 10.314-23.714 17.823-52.936 22.527a2.852 2.852 0 0 1-1.88-.345 2.726 2.726 0 0 1-.993-3.772l.5-.837c3.988-6.694 7.592-13.356 10.813-19.986 3.803-7.83 7.372-16.233 10.707-25.212Zm-85.67-7.776a2.852 2.852 0 0 1 1.878.345 2.726 2.726 0 0 1 .994 3.772l-.5.837c-3.988 6.694-7.592 13.356-10.813 19.986-3.803 7.83-7.372 16.233-10.707 25.212-.523 1.41-2.1 2.149-3.546 1.663l-.788-.266c-25.84-8.803-35.66-18.477-29.455-29.022C14.87 78.25 32.516 70.74 61.738 66.036Zm41.807-31.57c20.107-17.57 33.176-21.079 39.206-10.528 5.898 10.32 3.764 29.08-6.403 56.28a2.748 2.748 0 0 1-1.21 1.424 2.713 2.713 0 0 1-3.717-1.041l-.475-.845a269.421 269.421 0 0 0-11.888-19.191c-4.867-7.15-10.34-14.39-16.421-21.716a2.776 2.776 0 0 1 .296-3.847ZM57.684 18c11.706 0 26.607 11.091 44.703 33.273.402.492.618 1.11.613 1.745a2.712 2.712 0 0 1-2.73 2.694l-.955-.007c-7.62-.041-15.03.223-22.226.794-8.498.673-17.373 1.826-26.623 3.46a2.708 2.708 0 0 1-3.126-2.153l-.153-.792C42.217 31.004 45.717 18 57.684 18Z" fill="#FF4154"/></g></svg>
45-
title: TanStack Query <span class="soon">Soon</span>
46-
details: Generate query keys and query functions. Use them with our REST clients or bring your own.
45+
title: TanStack Query
46+
details: Generate query keys and functions. Use them with our REST clients or bring your own.
4747
link: /openapi-ts/tanstack-query
4848
linkText: Find out more
4949
---

docs/openapi-ts/clients/axios.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ bun add @hey-api/client-axios
4545

4646
Ensure you have already [configured](/openapi-ts/get-started) `@hey-api/openapi-ts`. Update your configuration to use the Axios client package.
4747

48-
```js{2}
48+
```js
4949
export default {
50-
client: '@hey-api/client-axios',
50+
client: '@hey-api/client-axios', // [!code ++]
5151
input: 'path/to/openapi.json',
5252
output: 'src/client',
53-
}
53+
};
5454
```
5555

5656
You can now run `openapi-ts` to use the new Axios client. 🎉

docs/openapi-ts/clients/fetch.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ bun add @hey-api/client-fetch
4545

4646
Ensure you have already [configured](/openapi-ts/get-started) `@hey-api/openapi-ts`. Update your configuration to use the Fetch API client package.
4747

48-
```js{2}
48+
```js
4949
export default {
50-
client: '@hey-api/client-fetch',
50+
client: '@hey-api/client-fetch', // [!code ++]
5151
input: 'path/to/openapi.json',
5252
output: 'src/client',
53-
}
53+
};
5454
```
5555

5656
You can now run `openapi-ts` to use the new Fetch API client. 🎉

docs/openapi-ts/clients/legacy.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,44 +13,44 @@ Before standalone client packages, clients were generated using `@hey-api/openap
1313

1414
::: code-group
1515

16-
```js{2} [fetch]
16+
```js [fetch]
1717
export default {
18-
client: 'fetch',
18+
client: 'fetch', // [!code ++]
1919
input: 'path/to/openapi.json',
2020
output: 'src/client',
21-
}
21+
};
2222
```
2323

24-
```js{2} [axios]
24+
```js [axios]
2525
export default {
26-
client: 'axios',
26+
client: 'axios', // [!code ++]
2727
input: 'path/to/openapi.json',
2828
output: 'src/client',
29-
}
29+
};
3030
```
3131

32-
```js{2} [angular]
32+
```js [angular]
3333
export default {
34-
client: 'angular',
34+
client: 'angular', // [!code ++]
3535
input: 'path/to/openapi.json',
3636
output: 'src/client',
37-
}
37+
};
3838
```
3939

40-
```js{2} [node]
40+
```js [node]
4141
export default {
42-
client: 'node',
42+
client: 'node', // [!code ++]
4343
input: 'path/to/openapi.json',
4444
output: 'src/client',
45-
}
45+
};
4646
```
4747

48-
```js{2} [xhr]
48+
```js [xhr]
4949
export default {
50-
client: 'xhr',
50+
client: 'xhr', // [!code ++]
5151
input: 'path/to/openapi.json',
5252
output: 'src/client',
53-
}
53+
};
5454
```
5555

5656
:::

docs/openapi-ts/configuration.md

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -84,37 +84,37 @@ By default, `@hey-api/openapi-ts` will only emit enums as types. You may want to
8484

8585
::: code-group
8686

87-
```js{6} [disabled]
87+
```js [disabled]
8888
export default {
8989
client: '@hey-api/client-fetch',
9090
input: 'path/to/openapi.json',
9191
output: 'src/client',
9292
types: {
93-
enums: false,
93+
enums: false, // [!code ++]
9494
},
95-
}
95+
};
9696
```
9797

98-
```js{6} [javascript]
98+
```js [javascript]
9999
export default {
100100
client: '@hey-api/client-fetch',
101101
input: 'path/to/openapi.json',
102102
output: 'src/client',
103103
types: {
104-
enums: 'javascript',
104+
enums: 'javascript', // [!code ++]
105105
},
106-
}
106+
};
107107
```
108108

109-
```js{6} [typescript]
109+
```js [typescript]
110110
export default {
111111
client: '@hey-api/client-fetch',
112112
input: 'path/to/openapi.json',
113113
output: 'src/client',
114114
types: {
115-
enums: 'typescript',
115+
enums: 'typescript', // [!code ++]
116116
},
117-
}
117+
};
118118
```
119119

120120
:::
@@ -127,35 +127,35 @@ By default, `@hey-api/openapi-ts` generates schemas from your OpenAPI specificat
127127

128128
::: code-group
129129

130-
```js{6} [json]
130+
```js [json]
131131
export default {
132132
client: '@hey-api/client-fetch',
133133
input: 'path/to/openapi.json',
134134
output: 'src/client',
135135
schemas: {
136-
type: 'json'
136+
type: 'json', // [!code ++]
137137
},
138-
}
138+
};
139139
```
140140

141-
```js{6} [form]
141+
```js [form]
142142
export default {
143143
client: '@hey-api/client-fetch',
144144
input: 'path/to/openapi.json',
145145
output: 'src/client',
146146
schemas: {
147-
type: 'form'
147+
type: 'form', // [!code ++]
148148
},
149-
}
149+
};
150150
```
151151

152-
```js{5} [disabled]
152+
```js [disabled]
153153
export default {
154154
client: '@hey-api/client-fetch',
155155
input: 'path/to/openapi.json',
156156
output: 'src/client',
157-
schemas: false,
158-
}
157+
schemas: false, // [!code ++]
158+
};
159159
```
160160

161161
:::
@@ -166,37 +166,37 @@ By default, `@hey-api/openapi-ts` will not automatically format your output. To
166166

167167
::: code-group
168168

169-
```js{5} [disabled]
169+
```js [disabled]
170170
export default {
171171
client: '@hey-api/client-fetch',
172172
input: 'path/to/openapi.json',
173173
output: {
174-
format: false,
174+
format: false, // [!code ++]
175175
path: 'src/client',
176176
},
177-
}
177+
};
178178
```
179179

180-
```js{5} [prettier]
180+
```js [prettier]
181181
export default {
182182
client: '@hey-api/client-fetch',
183183
input: 'path/to/openapi.json',
184184
output: {
185-
format: 'prettier',
185+
format: 'prettier', // [!code ++]
186186
path: 'src/client',
187187
},
188-
}
188+
};
189189
```
190190

191-
```js{5} [biome]
191+
```js [biome]
192192
export default {
193193
client: '@hey-api/client-fetch',
194194
input: 'path/to/openapi.json',
195195
output: {
196-
format: 'biome',
196+
format: 'biome', // [!code ++]
197197
path: 'src/client',
198198
},
199-
}
199+
};
200200
```
201201

202202
:::
@@ -209,37 +209,37 @@ By default, `@hey-api/openapi-ts` will not automatically lint your output. To en
209209

210210
::: code-group
211211

212-
```js{5} [disabled]
212+
```js [disabled]
213213
export default {
214214
client: '@hey-api/client-fetch',
215215
input: 'path/to/openapi.json',
216216
output: {
217-
lint: false,
217+
lint: false, // [!code ++]
218218
path: 'src/client',
219219
},
220-
}
220+
};
221221
```
222222

223-
```js{5} [eslint]
223+
```js [eslint]
224224
export default {
225225
client: '@hey-api/client-fetch',
226226
input: 'path/to/openapi.json',
227227
output: {
228-
lint: 'eslint',
228+
lint: 'eslint', // [!code ++]
229229
path: 'src/client',
230230
},
231-
}
231+
};
232232
```
233233

234-
```js{5} [biome]
234+
```js [biome]
235235
export default {
236236
client: '@hey-api/client-fetch',
237237
input: 'path/to/openapi.json',
238238
output: {
239-
lint: 'biome',
239+
lint: 'biome', // [!code ++]
240240
path: 'src/client',
241241
},
242-
}
242+
};
243243
```
244244

245245
:::

0 commit comments

Comments
 (0)