@hono/zod-openapi 0.9.2 → 0.9.4
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 +5 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/package.json +10 -8
package/README.md
CHANGED
|
@@ -51,6 +51,10 @@ const UserSchema = z
|
|
|
51
51
|
.openapi('User')
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
+
> [!TIP]
|
|
55
|
+
> `UserSchema` schema will be registered as `"#/components/schemas/User"` refs in the OpenAPI document.
|
|
56
|
+
> If you want to register the schema as referenced components, use `.opanapi()` method.
|
|
57
|
+
|
|
54
58
|
Next, create a route:
|
|
55
59
|
|
|
56
60
|
```ts
|
|
@@ -341,7 +345,7 @@ app.doc('/doc', c => ({
|
|
|
341
345
|
},
|
|
342
346
|
servers: [
|
|
343
347
|
{
|
|
344
|
-
url: new URL(c.req.url).
|
|
348
|
+
url: new URL(c.req.url).origin,
|
|
345
349
|
description: 'Current environment',
|
|
346
350
|
},
|
|
347
351
|
],
|
package/dist/index.d.mts
CHANGED
|
@@ -2,10 +2,10 @@ import * as openapi3_ts_oas31 from 'openapi3-ts/oas31';
|
|
|
2
2
|
import * as openapi3_ts_oas30 from 'openapi3-ts/oas30';
|
|
3
3
|
import { RouteConfig, ZodMediaTypeObject, OpenAPIRegistry, ZodRequestBody, ZodContentObject, ResponseConfig } from '@asteasolutions/zod-to-openapi';
|
|
4
4
|
import { OpenAPIObjectConfig } from '@asteasolutions/zod-to-openapi/dist/v3.0/openapi-generator';
|
|
5
|
-
import { Env, Input, Handler,
|
|
5
|
+
import { Env, Context, TypedResponse, Input, Handler, Schema, Hono, ToSchema } from 'hono';
|
|
6
6
|
import { MergeSchemaPath, MergePath } from 'hono/types';
|
|
7
7
|
import { RemoveBlankRecord } from 'hono/utils/types';
|
|
8
|
-
import { AnyZodObject, z, ZodSchema,
|
|
8
|
+
import { ZodError, AnyZodObject, z, ZodSchema, ZodType } from 'zod';
|
|
9
9
|
export { z } from 'zod';
|
|
10
10
|
|
|
11
11
|
type RequestTypes = {
|
|
@@ -100,4 +100,4 @@ declare const createRoute: <P extends string, R extends Omit<RouteConfig, "path"
|
|
|
100
100
|
getRoutingPath(): RoutingPath<R["path"]>;
|
|
101
101
|
};
|
|
102
102
|
|
|
103
|
-
export { OpenAPIHono, OpenAPIHonoOptions, OpenAPIObjectConfigure, RouteHandler, RouteHook, createRoute };
|
|
103
|
+
export { type Hook, OpenAPIHono, type OpenAPIHonoOptions, type OpenAPIObjectConfigure, type RouteHandler, type RouteHook, createRoute };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,10 +2,10 @@ import * as openapi3_ts_oas31 from 'openapi3-ts/oas31';
|
|
|
2
2
|
import * as openapi3_ts_oas30 from 'openapi3-ts/oas30';
|
|
3
3
|
import { RouteConfig, ZodMediaTypeObject, OpenAPIRegistry, ZodRequestBody, ZodContentObject, ResponseConfig } from '@asteasolutions/zod-to-openapi';
|
|
4
4
|
import { OpenAPIObjectConfig } from '@asteasolutions/zod-to-openapi/dist/v3.0/openapi-generator';
|
|
5
|
-
import { Env, Input, Handler,
|
|
5
|
+
import { Env, Context, TypedResponse, Input, Handler, Schema, Hono, ToSchema } from 'hono';
|
|
6
6
|
import { MergeSchemaPath, MergePath } from 'hono/types';
|
|
7
7
|
import { RemoveBlankRecord } from 'hono/utils/types';
|
|
8
|
-
import { AnyZodObject, z, ZodSchema,
|
|
8
|
+
import { ZodError, AnyZodObject, z, ZodSchema, ZodType } from 'zod';
|
|
9
9
|
export { z } from 'zod';
|
|
10
10
|
|
|
11
11
|
type RequestTypes = {
|
|
@@ -100,4 +100,4 @@ declare const createRoute: <P extends string, R extends Omit<RouteConfig, "path"
|
|
|
100
100
|
getRoutingPath(): RoutingPath<R["path"]>;
|
|
101
101
|
};
|
|
102
102
|
|
|
103
|
-
export { OpenAPIHono, OpenAPIHonoOptions, OpenAPIObjectConfigure, RouteHandler, RouteHook, createRoute };
|
|
103
|
+
export { type Hook, OpenAPIHono, type OpenAPIHonoOptions, type OpenAPIObjectConfigure, type RouteHandler, type RouteHook, createRoute };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hono/zod-openapi",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.4",
|
|
4
4
|
"description": "A wrapper class of Hono which supports OpenAPI.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
11
|
"scripts": {
|
|
12
|
-
"test": "vitest run && vitest typecheck --run --passWithNoTests",
|
|
12
|
+
"test": "vitest run && vitest --typecheck --run --passWithNoTests",
|
|
13
13
|
"build": "tsup ./src/index.ts --format esm,cjs --dts",
|
|
14
14
|
"publint": "publint",
|
|
15
15
|
"release": "yarn build && yarn test && yarn publint && yarn publish"
|
|
@@ -27,7 +27,6 @@
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
"license": "MIT",
|
|
30
|
-
"private": false,
|
|
31
30
|
"publishConfig": {
|
|
32
31
|
"registry": "https://registry.npmjs.org",
|
|
33
32
|
"access": "public"
|
|
@@ -38,19 +37,22 @@
|
|
|
38
37
|
},
|
|
39
38
|
"homepage": "https://github.com/honojs/middleware",
|
|
40
39
|
"peerDependencies": {
|
|
41
|
-
"hono": ">=3.11.
|
|
40
|
+
"hono": ">=3.11.3",
|
|
42
41
|
"zod": "3.*"
|
|
43
42
|
},
|
|
44
43
|
"devDependencies": {
|
|
45
|
-
"
|
|
46
|
-
"
|
|
44
|
+
"hono": "^3.11.7",
|
|
45
|
+
"jest": "^29.7.0",
|
|
46
|
+
"openapi3-ts": "^4.1.2",
|
|
47
|
+
"tsup": "^8.0.1",
|
|
48
|
+
"vitest": "^1.0.1",
|
|
47
49
|
"zod": "^3.22.1"
|
|
48
50
|
},
|
|
49
51
|
"dependencies": {
|
|
50
52
|
"@asteasolutions/zod-to-openapi": "^5.5.0",
|
|
51
|
-
"@hono/zod-validator": "^0.1.
|
|
53
|
+
"@hono/zod-validator": "^0.1.11"
|
|
52
54
|
},
|
|
53
55
|
"engines": {
|
|
54
56
|
"node": ">=16.0.0"
|
|
55
57
|
}
|
|
56
|
-
}
|
|
58
|
+
}
|