Skip to content

Commit 557dce2

Browse files
authored
Merge pull request #2610 from brolnickij/refactor/2597
refactor(pinia-colada): migrate queries to `defineQueryOptions`
2 parents 6da3159 + a3b29a9 commit 557dce2

File tree

426 files changed

+28389
-1155
lines changed

Some content is hidden

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

426 files changed

+28389
-1155
lines changed
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+
feat(pinia-colada): query options use `defineQueryOptions`

docs/data/people.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ type Person = {
33
name: string;
44
};
55

6+
export const dmitriyBrolnickij: Person = {
7+
github: 'https://github.com/brolnickij',
8+
name: 'Dmitriy Brolnickij',
9+
};
10+
611
export const jacobCohen: Person = {
712
github: 'https://github.com/jacobinu',
813
name: 'Jacob Cohen',

docs/openapi-ts/clients/ofetch.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ title: OFetch Client
33
description: Generate a type-safe ofetch client from OpenAPI with the ofetch client for openapi-ts. Fully compatible with validators, transformers, and all core features.
44
---
55

6+
<script setup lang="ts">
7+
import AuthorsList from '@components/AuthorsList.vue';
8+
import { dmitriyBrolnickij } from '@data/people.js';
9+
</script>
10+
611
# OFetch
712

813
### About
@@ -11,6 +16,10 @@ description: Generate a type-safe ofetch client from OpenAPI with the ofetch cli
1116

1217
The `ofetch` client for Hey API generates a type-safe client from your OpenAPI spec, fully compatible with validators, transformers, and all core features.
1318

19+
### Collaborators
20+
21+
<AuthorsList :people="[dmitriyBrolnickij]" />
22+
1423
## Features
1524

1625
- seamless integration with `@hey-api/openapi-ts` ecosystem

docs/openapi-ts/plugins/pinia-colada.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ description: Generate Pinia Colada v0 functions and query keys from OpenAPI with
77
import AuthorsList from '@components/AuthorsList.vue';
88
import Heading from '@components/Heading.vue';
99
import VersionLabel from '@components/VersionLabel.vue';
10-
import { joshHemphill, sebastiaanWouters } from '@data/people.js';
10+
import { joshHemphill, sebastiaanWouters, dmitriyBrolnickij } from '@data/people.js';
1111
</script>
1212

1313
<Heading>
@@ -23,7 +23,7 @@ The Pinia Colada plugin for Hey API generates functions and query keys from your
2323

2424
### Collaborators
2525

26-
<AuthorsList :people="[joshHemphill, sebastiaanWouters]" />
26+
<AuthorsList :people="[dmitriyBrolnickij, joshHemphill, sebastiaanWouters]" />
2727

2828
## Features
2929

@@ -65,13 +65,11 @@ Queries are generated from [query operations](/openapi-ts/configuration/parser#h
6565
::: code-group
6666

6767
```ts [example]
68-
const query = useQuery({
69-
...getPetByIdQuery({
70-
path: {
71-
petId: 1,
72-
},
73-
}),
74-
});
68+
const query = useQuery(getPetByIdQuery, () => ({
69+
path: {
70+
petId: 1,
71+
},
72+
}));
7573
```
7674

7775
```js [config]

examples/openapi-ts-pinia-colada/openapi-ts.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ export default defineConfig({
1818
},
1919
{
2020
exportFromIndex: true,
21-
name: '@pinia/colada'
21+
name: '@pinia/colada',
22+
queryKeys: false
2223
}
2324
]
2425
})

0 commit comments

Comments
 (0)