@beignet/core 0.0.45 → 0.0.46
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/CHANGELOG.md +6 -0
- package/README.md +30 -0
- package/package.json +3 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -2274,6 +2274,36 @@ OpenAPI `operationId` defaults to the stable contract name. Explicit operation
|
|
|
2274
2274
|
IDs are supported when an external SDK needs a different method name; server
|
|
2275
2275
|
registration and OpenAPI generation reject duplicates.
|
|
2276
2276
|
|
|
2277
|
+
### External TypeScript clients
|
|
2278
|
+
|
|
2279
|
+
Applications outside the contract-owning codebase can generate types from the
|
|
2280
|
+
served OpenAPI document and use them with an independent client:
|
|
2281
|
+
|
|
2282
|
+
```bash
|
|
2283
|
+
bun add openapi-fetch
|
|
2284
|
+
bun add --dev openapi-typescript typescript
|
|
2285
|
+
bunx openapi-typescript https://api.example.com/api/openapi --output src/generated/api.ts
|
|
2286
|
+
```
|
|
2287
|
+
|
|
2288
|
+
```ts
|
|
2289
|
+
import createClient from "openapi-fetch";
|
|
2290
|
+
import type { paths } from "./generated/api";
|
|
2291
|
+
|
|
2292
|
+
const api = createClient<paths>({
|
|
2293
|
+
baseUrl: "https://api.example.com",
|
|
2294
|
+
});
|
|
2295
|
+
|
|
2296
|
+
const { data, error } = await api.GET("/api/todos/{id}", {
|
|
2297
|
+
params: { path: { id: "todo_123" } },
|
|
2298
|
+
});
|
|
2299
|
+
```
|
|
2300
|
+
|
|
2301
|
+
The generated client types cover paths, parameters, JSON bodies, responses,
|
|
2302
|
+
and declared catalog errors. Map OpenAPI `string/binary` schemas to `Blob`
|
|
2303
|
+
through the generator's Node API for typed uploads and downloads. See the
|
|
2304
|
+
[OpenAPI guide](https://beignetjs.com/openapi) for the complete generation,
|
|
2305
|
+
non-JSON media, authentication, and CI drift workflow.
|
|
2306
|
+
|
|
2277
2307
|
### Schema introspection
|
|
2278
2308
|
|
|
2279
2309
|
Contracts expose their schemas for runtime introspection:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beignet/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.46",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Core framework primitives for Beignet",
|
|
6
6
|
"exports": {
|
|
@@ -215,6 +215,8 @@
|
|
|
215
215
|
"devDependencies": {
|
|
216
216
|
"@types/bun": "^1.3.13",
|
|
217
217
|
"@types/node": "^20.10.0",
|
|
218
|
+
"openapi-fetch": "^0.17.0",
|
|
219
|
+
"openapi-typescript": "^7.13.0",
|
|
218
220
|
"typescript": "^5.3.0",
|
|
219
221
|
"zod": "^4.0.0"
|
|
220
222
|
}
|