Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@hono/zod-openapi

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hono/zod-openapi - npm Package Compare versions

Comparing version 0.9.10 to 0.10.0

14

dist/index.d.ts

@@ -29,3 +29,3 @@ import * as openapi3_ts_oas31 from 'openapi3-ts/oas31';

} : {} : {};
type InputTypeJson<R extends RouteConfig> = R['request'] extends RequestTypes ? R['request']['body'] extends ZodRequestBody ? R['request']['body']['content'] extends ZodContentObject ? IsJson<keyof R['request']['body']['content']> extends never ? {} : R['request']['body']['content'][keyof R['request']['body']['content']]['schema'] extends ZodSchema<any> ? {
type InputTypeJson<R extends RouteConfig> = R['request'] extends RequestTypes ? R['request']['body'] extends ZodRequestBody ? R['request']['body']['content'] extends ZodContentObject ? IsJson<keyof R['request']['body']['content']> extends never ? {} : R['request']['body']['content'][keyof R['request']['body']['content']] extends Record<'schema', ZodSchema<any>> ? {
in: {

@@ -38,3 +38,3 @@ json: z.input<R['request']['body']['content'][keyof R['request']['body']['content']]['schema']>;

} : {} : {} : {} : {};
type InputTypeForm<R extends RouteConfig> = R['request'] extends RequestTypes ? R['request']['body'] extends ZodRequestBody ? R['request']['body']['content'] extends ZodContentObject ? IsForm<keyof R['request']['body']['content']> extends never ? {} : R['request']['body']['content'][keyof R['request']['body']['content']]['schema'] extends ZodSchema<any> ? {
type InputTypeForm<R extends RouteConfig> = R['request'] extends RequestTypes ? R['request']['body'] extends ZodRequestBody ? R['request']['body']['content'] extends ZodContentObject ? IsForm<keyof R['request']['body']['content']> extends never ? {} : R['request']['body']['content'][keyof R['request']['body']['content']] extends Record<'schema', ZodSchema<any>> ? {
in: {

@@ -51,3 +51,3 @@ form: z.input<R['request']['body']['content'][keyof R['request']['body']['content']]['schema']>;

type InputTypeCookie<R extends RouteConfig> = InputTypeBase<R, 'cookies', 'cookie'>;
type OutputType<R extends RouteConfig> = R['responses'] extends Record<infer _, infer C> ? C extends ResponseConfig ? C['content'] extends ZodContentObject ? IsJson<keyof C['content']> extends never ? {} : C['content'][keyof C['content']]['schema'] extends ZodSchema ? z.infer<C['content'][keyof C['content']]['schema']> : {} : {} : {} : {};
type OutputType<R extends RouteConfig> = R['responses'] extends Record<infer _, infer C> ? C extends ResponseConfig ? C['content'] extends ZodContentObject ? IsJson<keyof C['content']> extends never ? {} : C['content'][keyof C['content']] extends Record<'schema', ZodSchema> ? z.infer<C['content'][keyof C['content']]['schema']> : {} : {} : {} : {};
type Hook<T, E extends Env, P extends string, O> = (result: {

@@ -90,7 +90,7 @@ success: true;

};
} ? HandlerTypedResponse<OutputType<R>> : HandlerAllResponse<OutputType<R>>>, hook?: Hook<I, E, P, OutputType<R>> | undefined) => OpenAPIHono<E, S & ToSchema<R["method"], MergePath<BasePath, P>, I["in"], OutputType<R>>, BasePath>;
} ? HandlerTypedResponse<OutputType<R>> : HandlerAllResponse<OutputType<R>>>, hook?: Hook<I, E, P, OutputType<R>> | undefined) => OpenAPIHono<E, S & ToSchema<R['method'], MergePath<BasePath, P>, I['in'], OutputType<R>>, BasePath>;
getOpenAPIDocument: (config: OpenAPIObjectConfig) => openapi3_ts_oas30.OpenAPIObject;
getOpenAPI31Document: (config: OpenAPIObjectConfig) => openapi3_ts_oas31.OpenAPIObject;
doc: <P extends string>(path: P, configure: OpenAPIObjectConfigure<E, P>) => OpenAPIHono<E, S & ToSchema<"get", P, {}, {}>, BasePath>;
doc31: <P extends string>(path: P, configure: OpenAPIObjectConfigure<E, P>) => OpenAPIHono<E, S & ToSchema<"get", P, {}, {}>, BasePath>;
doc: <P extends string>(path: P, configure: OpenAPIObjectConfigure<E, P>) => OpenAPIHono<E, S & ToSchema<'get', P, {}, {}>, BasePath>;
doc31: <P extends string>(path: P, configure: OpenAPIObjectConfigure<E, P>) => OpenAPIHono<E, S & ToSchema<'get', P, {}, {}>, BasePath>;
route<SubPath extends string, SubEnv extends Env, SubSchema extends Schema, SubBasePath extends string>(path: SubPath, app: Hono<SubEnv, SubSchema, SubBasePath>): OpenAPIHono<E, MergeSchemaPath<SubSchema, MergePath<BasePath, SubPath>> & S, BasePath>;

@@ -104,5 +104,5 @@ route<SubPath extends string>(path: SubPath): Hono<E, RemoveBlankRecord<S>, BasePath>;

}>(routeConfig: R) => R & {
getRoutingPath(): RoutingPath<R["path"]>;
getRoutingPath(): RoutingPath<R['path']>;
};
export { type Hook, OpenAPIHono, type OpenAPIHonoOptions, type OpenAPIObjectConfigure, type RouteHandler, type RouteHook, createRoute };

@@ -64,15 +64,16 @@ "use strict";

for (const mediaType of Object.keys(bodyContent)) {
if (!bodyContent[mediaType]) {
continue;
}
const schema = bodyContent[mediaType]["schema"];
if (!(schema instanceof import_zod.ZodType)) {
continue;
}
if (mediaType.startsWith("application/json")) {
const schema = bodyContent[mediaType]["schema"];
if (schema instanceof import_zod.ZodType) {
const validator = (0, import_zod_validator.zValidator)("json", schema, hook);
validators.push(validator);
}
const validator = (0, import_zod_validator.zValidator)("json", schema, hook);
validators.push(validator);
}
if (mediaType.startsWith("multipart/form-data") || mediaType.startsWith("application/x-www-form-urlencoded")) {
const schema = bodyContent[mediaType]["schema"];
if (schema instanceof import_zod.ZodType) {
const validator = (0, import_zod_validator.zValidator)("form", schema, hook);
validators.push(validator);
}
const validator = (0, import_zod_validator.zValidator)("form", schema, hook);
validators.push(validator);
}

@@ -79,0 +80,0 @@ }

{
"name": "@hono/zod-openapi",
"version": "0.9.10",
"version": "0.10.0",
"description": "A wrapper class of Hono which supports OpenAPI.",

@@ -45,12 +45,12 @@ "main": "dist/index.js",

"@cloudflare/workers-types": "^4.20240117.0",
"hono": "^3.11.7",
"hono": "^4.2.2",
"jest": "^29.7.0",
"openapi3-ts": "^4.1.2",
"tsup": "^8.0.1",
"typescript": "^5.3.3",
"vitest": "^1.0.1",
"typescript": "^5.4.4",
"vitest": "^1.4.0",
"zod": "^3.22.1"
},
"dependencies": {
"@asteasolutions/zod-to-openapi": "^5.5.0",
"@asteasolutions/zod-to-openapi": "^7.0.0",
"@hono/zod-validator": "0.2.1"

@@ -57,0 +57,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc