@hono/zod-openapi 0.14.2 → 0.14.3
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/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +1 -2
- package/dist/index.mjs +3 -3
- package/package.json +1 -2
package/dist/index.d.mts
CHANGED
|
@@ -6,7 +6,7 @@ import { MiddlewareHandler, TypedResponse, Env, Context, Input, Handler, Schema,
|
|
|
6
6
|
import { MergePath, MergeSchemaPath } from 'hono/types';
|
|
7
7
|
import { StatusCode, InfoStatusCode, SuccessStatusCode, RedirectStatusCode, ClientErrorStatusCode, ServerErrorStatusCode } from 'hono/utils/http-status';
|
|
8
8
|
import { RemoveBlankRecord } from 'hono/utils/types';
|
|
9
|
-
import { ZodError,
|
|
9
|
+
import { ZodError, ZodType, z, ZodSchema } from 'zod';
|
|
10
10
|
export { z } from 'zod';
|
|
11
11
|
|
|
12
12
|
type MaybePromise<T> = Promise<T> | T;
|
|
@@ -15,15 +15,15 @@ type RouteConfig = RouteConfig$1 & {
|
|
|
15
15
|
};
|
|
16
16
|
type RequestTypes = {
|
|
17
17
|
body?: ZodRequestBody;
|
|
18
|
-
params?:
|
|
19
|
-
query?:
|
|
20
|
-
cookies?:
|
|
21
|
-
headers?:
|
|
18
|
+
params?: ZodType;
|
|
19
|
+
query?: ZodType;
|
|
20
|
+
cookies?: ZodType;
|
|
21
|
+
headers?: ZodType | ZodType[];
|
|
22
22
|
};
|
|
23
23
|
type IsJson<T> = T extends string ? T extends `application/json${infer _Rest}` ? 'json' : never : never;
|
|
24
24
|
type IsForm<T> = T extends string ? T extends `multipart/form-data${infer _Rest}` | `application/x-www-form-urlencoded${infer _Rest}` ? 'form' : never : never;
|
|
25
25
|
type RequestPart<R extends RouteConfig, Part extends string> = Part extends keyof R['request'] ? R['request'][Part] : {};
|
|
26
|
-
type InputTypeBase<R extends RouteConfig, Part extends string, Type extends string> = R['request'] extends RequestTypes ? RequestPart<R, Part> extends
|
|
26
|
+
type InputTypeBase<R extends RouteConfig, Part extends string, Type extends string> = R['request'] extends RequestTypes ? RequestPart<R, Part> extends ZodType ? {
|
|
27
27
|
in: {
|
|
28
28
|
[K in Type]: z.input<RequestPart<R, Part>>;
|
|
29
29
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { MiddlewareHandler, TypedResponse, Env, Context, Input, Handler, Schema,
|
|
|
6
6
|
import { MergePath, MergeSchemaPath } from 'hono/types';
|
|
7
7
|
import { StatusCode, InfoStatusCode, SuccessStatusCode, RedirectStatusCode, ClientErrorStatusCode, ServerErrorStatusCode } from 'hono/utils/http-status';
|
|
8
8
|
import { RemoveBlankRecord } from 'hono/utils/types';
|
|
9
|
-
import { ZodError,
|
|
9
|
+
import { ZodError, ZodType, z, ZodSchema } from 'zod';
|
|
10
10
|
export { z } from 'zod';
|
|
11
11
|
|
|
12
12
|
type MaybePromise<T> = Promise<T> | T;
|
|
@@ -15,15 +15,15 @@ type RouteConfig = RouteConfig$1 & {
|
|
|
15
15
|
};
|
|
16
16
|
type RequestTypes = {
|
|
17
17
|
body?: ZodRequestBody;
|
|
18
|
-
params?:
|
|
19
|
-
query?:
|
|
20
|
-
cookies?:
|
|
21
|
-
headers?:
|
|
18
|
+
params?: ZodType;
|
|
19
|
+
query?: ZodType;
|
|
20
|
+
cookies?: ZodType;
|
|
21
|
+
headers?: ZodType | ZodType[];
|
|
22
22
|
};
|
|
23
23
|
type IsJson<T> = T extends string ? T extends `application/json${infer _Rest}` ? 'json' : never : never;
|
|
24
24
|
type IsForm<T> = T extends string ? T extends `multipart/form-data${infer _Rest}` | `application/x-www-form-urlencoded${infer _Rest}` ? 'form' : never : never;
|
|
25
25
|
type RequestPart<R extends RouteConfig, Part extends string> = Part extends keyof R['request'] ? R['request'][Part] : {};
|
|
26
|
-
type InputTypeBase<R extends RouteConfig, Part extends string, Type extends string> = R['request'] extends RequestTypes ? RequestPart<R, Part> extends
|
|
26
|
+
type InputTypeBase<R extends RouteConfig, Part extends string, Type extends string> = R['request'] extends RequestTypes ? RequestPart<R, Part> extends ZodType ? {
|
|
27
27
|
in: {
|
|
28
28
|
[K in Type]: z.input<RequestPart<R, Part>>;
|
|
29
29
|
};
|
package/dist/index.js
CHANGED
|
@@ -26,7 +26,6 @@ __export(src_exports, {
|
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(src_exports);
|
|
28
28
|
var import_zod_to_openapi = require("@asteasolutions/zod-to-openapi");
|
|
29
|
-
var import_zod_to_openapi2 = require("@asteasolutions/zod-to-openapi");
|
|
30
29
|
var import_zod_validator = require("@hono/zod-validator");
|
|
31
30
|
var import_hono = require("hono");
|
|
32
31
|
var import_url = require("hono/utils/url");
|
|
@@ -199,7 +198,7 @@ var createRoute = (routeConfig) => {
|
|
|
199
198
|
};
|
|
200
199
|
return Object.defineProperty(route, "getRoutingPath", { enumerable: false });
|
|
201
200
|
};
|
|
202
|
-
(0,
|
|
201
|
+
(0, import_zod_to_openapi.extendZodWithOpenApi)(import_zod.z);
|
|
203
202
|
// Annotate the CommonJS export names for ESM import in node:
|
|
204
203
|
0 && (module.exports = {
|
|
205
204
|
OpenAPIHono,
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
import {
|
|
3
|
+
OpenAPIRegistry,
|
|
3
4
|
OpenApiGeneratorV3,
|
|
4
5
|
OpenApiGeneratorV31,
|
|
5
|
-
|
|
6
|
+
extendZodWithOpenApi
|
|
6
7
|
} from "@asteasolutions/zod-to-openapi";
|
|
7
|
-
import { extendZodWithOpenApi } from "@asteasolutions/zod-to-openapi";
|
|
8
8
|
import { zValidator } from "@hono/zod-validator";
|
|
9
9
|
import { Hono } from "hono";
|
|
10
10
|
import { mergePath } from "hono/utils/url";
|
|
11
|
-
import {
|
|
11
|
+
import { ZodType, z } from "zod";
|
|
12
12
|
var OpenAPIHono = class _OpenAPIHono extends Hono {
|
|
13
13
|
openAPIRegistry;
|
|
14
14
|
defaultHook;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hono/zod-openapi",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.3",
|
|
4
4
|
"description": "A wrapper class of Hono which supports OpenAPI.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -44,7 +44,6 @@
|
|
|
44
44
|
"@cloudflare/workers-types": "^4.20240117.0",
|
|
45
45
|
"hono": "^4.3.6",
|
|
46
46
|
"jest": "^29.7.0",
|
|
47
|
-
"openapi3-ts": "^4.1.2",
|
|
48
47
|
"tsup": "^8.0.1",
|
|
49
48
|
"typescript": "^5.4.4",
|
|
50
49
|
"vitest": "^1.4.0",
|