Skip to content

Commit a3b29a9

Browse files
committed
docs: revert some changes
1 parent fcdb3f2 commit a3b29a9

File tree

2 files changed

+15
-44
lines changed

2 files changed

+15
-44
lines changed

.changeset/refactor-pinia-colada-query.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
"@hey-api/openapi-ts": patch
33
---
44

5-
refactor(pinia-colada): migrate queries to `defineQueryOptions`
5+
feat(pinia-colada): query options use `defineQueryOptions`

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

Lines changed: 14 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ The Pinia Colada plugin for Hey API generates functions and query keys from your
2323

2424
### Collaborators
2525

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

2828
## Features
2929

3030
- Pinia Colada v0 support
3131
- seamless integration with `@hey-api/openapi-ts` ecosystem
3232
- create query keys following the best practices
33-
- type-safe query options (using `defineQueryOptions`) and mutation options
33+
- type-safe query options and mutation options
3434
- minimal learning curve thanks to extending the underlying technology
3535

3636
## Installation
@@ -62,9 +62,17 @@ The Pinia Colada plugin will generate the following artifacts, depending on the
6262

6363
Queries are generated from [query operations](/openapi-ts/configuration/parser#hooks-query-operations). The generated query functions follow the naming convention of SDK functions and by default append `Query`, e.g. `getPetByIdQuery()`.
6464

65-
Each generated function is a [`defineQueryOptions`](https://pinia-colada.esm.dev/api/@pinia/colada/functions/defineQueryOptions.html) factory.
65+
::: code-group
6666

67-
```js
67+
```ts [example]
68+
const query = useQuery(getPetByIdQuery, () => ({
69+
path: {
70+
petId: 1,
71+
},
72+
}));
73+
```
74+
75+
```js [config]
6876
export default {
6977
input: 'hey-api/backend', // sign up at app.heyapi.dev
7078
output: 'src/client',
@@ -78,46 +86,9 @@ export default {
7886
};
7987
```
8088

81-
You can customize the naming and casing pattern for `queryOptions` functions using the `.name` and `.case` options.
82-
83-
### Usage
84-
85-
No params — pass the function directly to `useQuery`:
86-
87-
```ts
88-
useQuery(getPetsQuery);
89-
```
90-
91-
With parameters (constant values), use the two‑argument form:
92-
93-
```ts
94-
useQuery(getPetByIdQuery, () => ({
95-
path: { petId: 1 },
96-
}));
97-
```
98-
99-
For reactive parameters, pass the generated function and compute options in the callback:
100-
101-
```ts
102-
const petId = ref<number | null>(1);
103-
104-
useQuery(getPetByIdQuery, () => ({
105-
path: { petId: petId.value },
106-
}));
107-
```
108-
109-
To pass `useQuery` [properties](https://pinia-colada.esm.dev/api/@pinia/colada/interfaces/UseQueryOptions.html#Properties):
110-
111-
```ts
112-
const petId = ref<number | null>(null);
89+
:::
11390

114-
useQuery(() => ({
115-
...getPetByIdQuery({
116-
path: { petId: petId.value as number },
117-
}),
118-
enabled: () => petId.value != null,
119-
}));
120-
```
91+
You can customize the naming and casing pattern for `queryOptions` functions using the `.name` and `.case` options.
12192

12293
## Query Keys
12394

0 commit comments

Comments
 (0)