@codewithagents/openapi-server 1.6.0 → 1.8.0
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/README.md +6 -6
- package/dist/cli-args.d.ts +1 -1
- package/dist/cli-args.d.ts.map +1 -1
- package/dist/cli-args.js +1 -1
- package/dist/cli-args.js.map +1 -1
- package/dist/cli.cjs +213 -254
- package/dist/config.d.ts +9 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +35 -21
- package/dist/config.js.map +1 -1
- package/dist/generator.d.ts.map +1 -1
- package/dist/generator.js +58 -63
- package/dist/generator.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/plugins/router.d.ts +1 -1
- package/dist/plugins/router.d.ts.map +1 -1
- package/dist/plugins/router.js +1 -167
- package/dist/plugins/router.js.map +1 -1
- package/dist/plugins/service.d.ts +1 -1
- package/dist/plugins/service.d.ts.map +1 -1
- package/dist/plugins/service.js +4 -172
- package/dist/plugins/service.js.map +1 -1
- package/dist/plugins/shared.d.ts +44 -0
- package/dist/plugins/shared.d.ts.map +1 -0
- package/dist/plugins/shared.js +180 -0
- package/dist/plugins/shared.js.map +1 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ pnpm add -D @codewithagents/openapi-server
|
|
|
26
26
|
npm install -D @codewithagents/openapi-server
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
Requires [
|
|
29
|
+
Requires [`openapi-zod-ts`](../openapi-zod-ts). Run both generators together.
|
|
30
30
|
|
|
31
31
|
---
|
|
32
32
|
|
|
@@ -55,10 +55,10 @@ npx openapi-server
|
|
|
55
55
|
| `service.ts` | TypeScript interface, one method per API operation |
|
|
56
56
|
| `router.ts` | `createRouter(service)` factory, mounts every route on a Hono app |
|
|
57
57
|
|
|
58
|
-
Run `openapi-
|
|
58
|
+
Run `openapi-zod-ts` first (or together) so `models.ts` exists before `service.ts` imports from it:
|
|
59
59
|
|
|
60
60
|
```bash
|
|
61
|
-
npx openapi-
|
|
61
|
+
npx openapi-zod-ts && npx openapi-server
|
|
62
62
|
```
|
|
63
63
|
|
|
64
64
|
Or add to `package.json`:
|
|
@@ -66,7 +66,7 @@ Or add to `package.json`:
|
|
|
66
66
|
```json
|
|
67
67
|
{
|
|
68
68
|
"scripts": {
|
|
69
|
-
"generate": "openapi-
|
|
69
|
+
"generate": "openapi-zod-ts && openapi-server"
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
```
|
|
@@ -241,7 +241,7 @@ Relative paths in the config resolve from the config file's directory.
|
|
|
241
241
|
|
|
242
242
|
See the [Zod validation](https://openapi.codewithagents.de/openapi-server#zod-validation-input_schema) section in the docs for the two-pass generation flow and schema naming convention.
|
|
243
243
|
|
|
244
|
-
Point `input_schema` at the same `schemas.ts` you use with
|
|
244
|
+
Point `input_schema` at the same `schemas.ts` you use with `openapi-zod-ts`. The server generator adds runtime validation to every route that receives a request body:
|
|
245
245
|
|
|
246
246
|
**Config:**
|
|
247
247
|
|
|
@@ -278,7 +278,7 @@ Invalid requests get a structured `422` response instead of reaching your servic
|
|
|
278
278
|
}
|
|
279
279
|
```
|
|
280
280
|
|
|
281
|
-
**Same schemas, both sides of the wire**: `openapi-
|
|
281
|
+
**Same schemas, both sides of the wire**: `openapi-zod-ts` validates outgoing requests in the browser; `openapi-server` validates incoming requests on the server. One `schemas.ts`, one source of truth.
|
|
282
282
|
|
|
283
283
|
**Drift detection**: if schemas diverge from the spec (extra schema, missing schema), the generator warns to stderr. Builds still succeed; the warning is advisory.
|
|
284
284
|
|
package/dist/cli-args.d.ts
CHANGED
package/dist/cli-args.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-args.d.ts","sourceRoot":"","sources":["../src/cli-args.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAoB,MAAM,
|
|
1
|
+
{"version":3,"file":"cli-args.d.ts","sourceRoot":"","sources":["../src/cli-args.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAoB,MAAM,yBAAyB,CAAA;AAE1E,YAAY,EAAE,SAAS,EAAE,CAAA;AAIzB;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,CAEnE"}
|
package/dist/cli-args.js
CHANGED
package/dist/cli-args.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-args.js","sourceRoot":"","sources":["../src/cli-args.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"cli-args.js","sourceRoot":"","sources":["../src/cli-args.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAI1E,MAAM,KAAK,GAAG,wDAAwD,CAAA;AAEtE;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,IAAc,EAAE,GAAW;IACtD,OAAO,gBAAgB,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC"}
|