@hono/zod-openapi 0.12.0 → 0.12.2

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 CHANGED
@@ -9,6 +9,7 @@ import { RemoveBlankRecord } from 'hono/utils/types';
9
9
  import { ZodError, AnyZodObject, z, ZodSchema, ZodType } from 'zod';
10
10
  export { z } from 'zod';
11
11
 
12
+ type MaybePromise<T> = Promise<T> | T;
12
13
  type RouteConfig = RouteConfig$1 & {
13
14
  middleware?: MiddlewareHandler | MiddlewareHandler[];
14
15
  };
@@ -76,7 +77,7 @@ type RouteHandler<R extends RouteConfig, E extends Env = Env, I extends Input =
76
77
  };
77
78
  };
78
79
  };
79
- } ? RouteConfigToTypedResponse<R> : RouteConfigToTypedResponse<R> | Response | Promise<Response>>;
80
+ } ? MaybePromise<RouteConfigToTypedResponse<R>> : MaybePromise<RouteConfigToTypedResponse<R>> | MaybePromise<Response>>;
80
81
  type RouteHook<R extends RouteConfig, E extends Env = Env, I extends Input = InputTypeParam<R> & InputTypeQuery<R> & InputTypeHeader<R> & InputTypeCookie<R> & InputTypeForm<R> & InputTypeJson<R>, P extends string = ConvertPathType<R['path']>> = Hook<I, E, P, RouteConfigToTypedResponse<R> | Response | Promise<Response> | void | Promise<void>>;
81
82
  type OpenAPIObjectConfigure<E extends Env, P extends string> = OpenAPIObjectConfig | ((context: Context<E, P>) => OpenAPIObjectConfig);
82
83
  declare class OpenAPIHono<E extends Env = Env, S extends Schema = {}, BasePath extends string = '/'> extends Hono<E, S, BasePath> {
@@ -122,7 +123,7 @@ declare class OpenAPIHono<E extends Env = Env, S extends Schema = {}, BasePath e
122
123
  };
123
124
  };
124
125
  };
125
- } ? RouteConfigToTypedResponse<R> : RouteConfigToTypedResponse<R> | Response | Promise<Response>>, hook?: Hook<I, E, P, RouteConfigToTypedResponse<R> | Response | Promise<Response> | void | Promise<void>> | undefined) => OpenAPIHono<E, S & ToSchema<R['method'], MergePath<BasePath, P>, I, RouteConfigToTypedResponse<R>>, BasePath>;
126
+ } ? MaybePromise<RouteConfigToTypedResponse<R>> : MaybePromise<RouteConfigToTypedResponse<R>> | MaybePromise<Response>>, hook?: Hook<I, E, P, RouteConfigToTypedResponse<R> | Response | Promise<Response> | void | Promise<void>> | undefined) => OpenAPIHono<E, S & ToSchema<R['method'], MergePath<BasePath, P>, I, RouteConfigToTypedResponse<R>>, BasePath>;
126
127
  getOpenAPIDocument: (config: OpenAPIObjectConfig) => openapi3_ts_oas30.OpenAPIObject;
127
128
  getOpenAPI31Document: (config: OpenAPIObjectConfig) => openapi3_ts_oas31.OpenAPIObject;
128
129
  doc: <P extends string>(path: P, configure: OpenAPIObjectConfigure<E, P>) => OpenAPIHono<E, S & ToSchema<'get', P, {}, {}>, BasePath>;
package/dist/index.d.ts CHANGED
@@ -9,6 +9,7 @@ import { RemoveBlankRecord } from 'hono/utils/types';
9
9
  import { ZodError, AnyZodObject, z, ZodSchema, ZodType } from 'zod';
10
10
  export { z } from 'zod';
11
11
 
12
+ type MaybePromise<T> = Promise<T> | T;
12
13
  type RouteConfig = RouteConfig$1 & {
13
14
  middleware?: MiddlewareHandler | MiddlewareHandler[];
14
15
  };
@@ -76,7 +77,7 @@ type RouteHandler<R extends RouteConfig, E extends Env = Env, I extends Input =
76
77
  };
77
78
  };
78
79
  };
79
- } ? RouteConfigToTypedResponse<R> : RouteConfigToTypedResponse<R> | Response | Promise<Response>>;
80
+ } ? MaybePromise<RouteConfigToTypedResponse<R>> : MaybePromise<RouteConfigToTypedResponse<R>> | MaybePromise<Response>>;
80
81
  type RouteHook<R extends RouteConfig, E extends Env = Env, I extends Input = InputTypeParam<R> & InputTypeQuery<R> & InputTypeHeader<R> & InputTypeCookie<R> & InputTypeForm<R> & InputTypeJson<R>, P extends string = ConvertPathType<R['path']>> = Hook<I, E, P, RouteConfigToTypedResponse<R> | Response | Promise<Response> | void | Promise<void>>;
81
82
  type OpenAPIObjectConfigure<E extends Env, P extends string> = OpenAPIObjectConfig | ((context: Context<E, P>) => OpenAPIObjectConfig);
82
83
  declare class OpenAPIHono<E extends Env = Env, S extends Schema = {}, BasePath extends string = '/'> extends Hono<E, S, BasePath> {
@@ -122,7 +123,7 @@ declare class OpenAPIHono<E extends Env = Env, S extends Schema = {}, BasePath e
122
123
  };
123
124
  };
124
125
  };
125
- } ? RouteConfigToTypedResponse<R> : RouteConfigToTypedResponse<R> | Response | Promise<Response>>, hook?: Hook<I, E, P, RouteConfigToTypedResponse<R> | Response | Promise<Response> | void | Promise<void>> | undefined) => OpenAPIHono<E, S & ToSchema<R['method'], MergePath<BasePath, P>, I, RouteConfigToTypedResponse<R>>, BasePath>;
126
+ } ? MaybePromise<RouteConfigToTypedResponse<R>> : MaybePromise<RouteConfigToTypedResponse<R>> | MaybePromise<Response>>, hook?: Hook<I, E, P, RouteConfigToTypedResponse<R> | Response | Promise<Response> | void | Promise<void>> | undefined) => OpenAPIHono<E, S & ToSchema<R['method'], MergePath<BasePath, P>, I, RouteConfigToTypedResponse<R>>, BasePath>;
126
127
  getOpenAPIDocument: (config: OpenAPIObjectConfig) => openapi3_ts_oas30.OpenAPIObject;
127
128
  getOpenAPI31Document: (config: OpenAPIObjectConfig) => openapi3_ts_oas31.OpenAPIObject;
128
129
  doc: <P extends string>(path: P, configure: OpenAPIObjectConfigure<E, P>) => OpenAPIHono<E, S & ToSchema<'get', P, {}, {}>, BasePath>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hono/zod-openapi",
3
- "version": "0.12.0",
3
+ "version": "0.12.2",
4
4
  "description": "A wrapper class of Hono which supports OpenAPI.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",