@appweaver/create-weaver-app 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/skill/references/client.md +18 -5
package/package.json
CHANGED
|
@@ -71,12 +71,15 @@ Reads an OpenAPI v3 schema and generates TypeScript types and a typed client cla
|
|
|
71
71
|
1. Reads and parses the schema (JSON or YAML, local or remote).
|
|
72
72
|
2. Generates TypeScript interfaces via `openapi-typescript`, enriching them with JSDoc validation tags (`@minLength`,
|
|
73
73
|
`@maxLength`, `@minimum`, `@maximum`, `@pattern`, `@format`).
|
|
74
|
-
3. Deduplicates union types and extracts inline schemas to named exported types
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
3. Deduplicates union types and extracts inline schemas to named exported types, including the ones carrying a
|
|
75
|
+
description (i.e. `PostQuerySort`).
|
|
76
|
+
4. Hoists the enums the schema repeats inline into a single shared enum each, so every sortable field of every resource
|
|
77
|
+
shares one `SortDirection` rather than declaring an `asc | desc` enum of its own.
|
|
78
|
+
5. Classifies all API paths into route groups: resources, auth, account, health, files, and custom.
|
|
79
|
+
6. Emits a typed client class extending `FetchClient<Paths>` with a getter for each route group. Resources with
|
|
77
80
|
unsupported operations are excluded at compile time using `Omit`.
|
|
78
|
-
|
|
79
|
-
|
|
81
|
+
7. Formats all output with Prettier.
|
|
82
|
+
8. Writes files with an autogenerated header comment.
|
|
80
83
|
|
|
81
84
|
**Examples:**
|
|
82
85
|
|
|
@@ -133,6 +136,16 @@ Contains all TypeScript interfaces and type aliases derived from the OpenAPI sch
|
|
|
133
136
|
namespace used to parameterise `FetchClient`. Module-level types (`AuthModuleType`, `AccountModuleType`,
|
|
134
137
|
`HealthModuleType`, per-resource `*ResourceModuleType`) are also exported and consumed by the client class.
|
|
135
138
|
|
|
139
|
+
Every schema definition becomes an exported type named after it, so the request and response shapes can be referenced
|
|
140
|
+
directly. The per-resource module type holds the same types under the keys the `ResourceClient` methods use:
|
|
141
|
+
|
|
142
|
+
```ts
|
|
143
|
+
import { PostQuerySort, SortDirection } from './generated/schema';
|
|
144
|
+
|
|
145
|
+
const sort: PostQuerySort = { createdAt: SortDirection.desc, title: SortDirection.asc };
|
|
146
|
+
const posts = await client.post.query({ sort, page: 1, size: 20 });
|
|
147
|
+
```
|
|
148
|
+
|
|
136
149
|
### Client file
|
|
137
150
|
|
|
138
151
|
```ts
|