@hono/zod-openapi 0.14.8 → 0.15.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/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -1
- package/dist/index.mjs +2 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as openapi3_ts_oas31 from 'openapi3-ts/oas31';
|
|
2
2
|
import * as openapi3_ts_oas30 from 'openapi3-ts/oas30';
|
|
3
3
|
import { RouteConfig as RouteConfig$1, ZodMediaTypeObject, OpenAPIRegistry, ZodRequestBody, ZodContentObject } from '@asteasolutions/zod-to-openapi';
|
|
4
|
+
export { extendZodWithOpenApi } from '@asteasolutions/zod-to-openapi';
|
|
4
5
|
import { OpenAPIObjectConfig } from '@asteasolutions/zod-to-openapi/dist/v3.0/openapi-generator';
|
|
5
6
|
import { MiddlewareHandler, TypedResponse, Env, Context, Input, Handler, Schema, Hono, ToSchema, ValidationTargets } from 'hono';
|
|
6
7
|
import { MergePath, MergeSchemaPath } from 'hono/types';
|
|
@@ -20,7 +21,7 @@ type RequestTypes = {
|
|
|
20
21
|
cookies?: ZodType;
|
|
21
22
|
headers?: ZodType | ZodType[];
|
|
22
23
|
};
|
|
23
|
-
type IsJson<T> = T extends string ? T extends `application
|
|
24
|
+
type IsJson<T> = T extends string ? T extends `application/${infer Start}json${infer _End}` ? Start extends '' | `${string}+` | `vnd.${string}+` ? 'json' : never : never : never;
|
|
24
25
|
type IsForm<T> = T extends string ? T extends `multipart/form-data${infer _Rest}` | `application/x-www-form-urlencoded${infer _Rest}` ? 'form' : never : never;
|
|
25
26
|
type RequestPart<R extends RouteConfig, Part extends string> = Part extends keyof R['request'] ? R['request'][Part] : {};
|
|
26
27
|
type HasUndefined<T> = undefined extends T ? true : false;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as openapi3_ts_oas31 from 'openapi3-ts/oas31';
|
|
2
2
|
import * as openapi3_ts_oas30 from 'openapi3-ts/oas30';
|
|
3
3
|
import { RouteConfig as RouteConfig$1, ZodMediaTypeObject, OpenAPIRegistry, ZodRequestBody, ZodContentObject } from '@asteasolutions/zod-to-openapi';
|
|
4
|
+
export { extendZodWithOpenApi } from '@asteasolutions/zod-to-openapi';
|
|
4
5
|
import { OpenAPIObjectConfig } from '@asteasolutions/zod-to-openapi/dist/v3.0/openapi-generator';
|
|
5
6
|
import { MiddlewareHandler, TypedResponse, Env, Context, Input, Handler, Schema, Hono, ToSchema, ValidationTargets } from 'hono';
|
|
6
7
|
import { MergePath, MergeSchemaPath } from 'hono/types';
|
|
@@ -20,7 +21,7 @@ type RequestTypes = {
|
|
|
20
21
|
cookies?: ZodType;
|
|
21
22
|
headers?: ZodType | ZodType[];
|
|
22
23
|
};
|
|
23
|
-
type IsJson<T> = T extends string ? T extends `application
|
|
24
|
+
type IsJson<T> = T extends string ? T extends `application/${infer Start}json${infer _End}` ? Start extends '' | `${string}+` | `vnd.${string}+` ? 'json' : never : never : never;
|
|
24
25
|
type IsForm<T> = T extends string ? T extends `multipart/form-data${infer _Rest}` | `application/x-www-form-urlencoded${infer _Rest}` ? 'form' : never : never;
|
|
25
26
|
type RequestPart<R extends RouteConfig, Part extends string> = Part extends keyof R['request'] ? R['request'][Part] : {};
|
|
26
27
|
type HasUndefined<T> = undefined extends T ? true : false;
|
package/dist/index.js
CHANGED
|
@@ -22,6 +22,7 @@ var src_exports = {};
|
|
|
22
22
|
__export(src_exports, {
|
|
23
23
|
OpenAPIHono: () => OpenAPIHono,
|
|
24
24
|
createRoute: () => createRoute,
|
|
25
|
+
extendZodWithOpenApi: () => import_zod_to_openapi.extendZodWithOpenApi,
|
|
25
26
|
z: () => import_zod.z
|
|
26
27
|
});
|
|
27
28
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -98,7 +99,7 @@ var OpenAPIHono = class _OpenAPIHono extends import_hono.Hono {
|
|
|
98
99
|
if (!(schema instanceof import_zod.ZodType)) {
|
|
99
100
|
continue;
|
|
100
101
|
}
|
|
101
|
-
if (
|
|
102
|
+
if (/^application\/([a-z-\.]+\+)?json/.test(mediaType)) {
|
|
102
103
|
const validator = (0, import_zod_validator.zValidator)("json", schema, hook);
|
|
103
104
|
validators.push(validator);
|
|
104
105
|
}
|
|
@@ -213,5 +214,6 @@ function addBasePathToDocument(document, basePath) {
|
|
|
213
214
|
0 && (module.exports = {
|
|
214
215
|
OpenAPIHono,
|
|
215
216
|
createRoute,
|
|
217
|
+
extendZodWithOpenApi,
|
|
216
218
|
z
|
|
217
219
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -77,7 +77,7 @@ var OpenAPIHono = class _OpenAPIHono extends Hono {
|
|
|
77
77
|
if (!(schema instanceof ZodType)) {
|
|
78
78
|
continue;
|
|
79
79
|
}
|
|
80
|
-
if (
|
|
80
|
+
if (/^application\/([a-z-\.]+\+)?json/.test(mediaType)) {
|
|
81
81
|
const validator = zValidator("json", schema, hook);
|
|
82
82
|
validators.push(validator);
|
|
83
83
|
}
|
|
@@ -191,5 +191,6 @@ function addBasePathToDocument(document, basePath) {
|
|
|
191
191
|
export {
|
|
192
192
|
OpenAPIHono,
|
|
193
193
|
createRoute,
|
|
194
|
+
extendZodWithOpenApi,
|
|
194
195
|
z
|
|
195
196
|
};
|