@hono/zod-openapi 0.16.1 → 0.16.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 CHANGED
@@ -2,7 +2,7 @@ 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, OpenApiGeneratorV3 } from '@asteasolutions/zod-to-openapi';
4
4
  export { extendZodWithOpenApi } from '@asteasolutions/zod-to-openapi';
5
- import { MiddlewareHandler, TypedResponse, Env, Context, Input, Handler, Schema, Hono, ToSchema, ValidationTargets } from 'hono';
5
+ import { MiddlewareHandler, TypedResponse, Env, ValidationTargets, Context, Input, Handler, Schema, Hono, ToSchema } from 'hono';
6
6
  import { MergePath, MergeSchemaPath } from 'hono/types';
7
7
  import { JSONParsed, RemoveBlankRecord } from 'hono/utils/types';
8
8
  import { StatusCode, InfoStatusCode, SuccessStatusCode, RedirectStatusCode, ClientErrorStatusCode, ServerErrorStatusCode } from 'hono/utils/http-status';
@@ -72,12 +72,14 @@ type RouteConfigToTypedResponse<R extends RouteConfig> = {
72
72
  [Status in keyof R['responses'] & RouteConfigStatusCode]: IsJson<keyof R['responses'][Status]['content']> extends never ? TypedResponse<{}, ExtractStatusCode<Status>, string> : TypedResponse<JSONParsed<ExtractContent<R['responses'][Status]['content']>>, ExtractStatusCode<Status>, 'json' | 'text'>;
73
73
  }[keyof R['responses'] & RouteConfigStatusCode];
74
74
  type Hook<T, E extends Env, P extends string, R> = (result: {
75
+ target: keyof ValidationTargets;
76
+ } & ({
75
77
  success: true;
76
78
  data: T;
77
79
  } | {
78
80
  success: false;
79
81
  error: ZodError;
80
- }, c: Context<E, P>) => R;
82
+ }), c: Context<E, P>) => R;
81
83
  type ConvertPathType<T extends string> = T extends `${infer Start}/{${infer Param}}${infer Rest}` ? `${Start}/:${Param}${ConvertPathType<Rest>}` : T;
82
84
  type OpenAPIHonoOptions<E extends Env> = {
83
85
  defaultHook?: Hook<any, E, any, any>;
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ 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, OpenApiGeneratorV3 } from '@asteasolutions/zod-to-openapi';
4
4
  export { extendZodWithOpenApi } from '@asteasolutions/zod-to-openapi';
5
- import { MiddlewareHandler, TypedResponse, Env, Context, Input, Handler, Schema, Hono, ToSchema, ValidationTargets } from 'hono';
5
+ import { MiddlewareHandler, TypedResponse, Env, ValidationTargets, Context, Input, Handler, Schema, Hono, ToSchema } from 'hono';
6
6
  import { MergePath, MergeSchemaPath } from 'hono/types';
7
7
  import { JSONParsed, RemoveBlankRecord } from 'hono/utils/types';
8
8
  import { StatusCode, InfoStatusCode, SuccessStatusCode, RedirectStatusCode, ClientErrorStatusCode, ServerErrorStatusCode } from 'hono/utils/http-status';
@@ -72,12 +72,14 @@ type RouteConfigToTypedResponse<R extends RouteConfig> = {
72
72
  [Status in keyof R['responses'] & RouteConfigStatusCode]: IsJson<keyof R['responses'][Status]['content']> extends never ? TypedResponse<{}, ExtractStatusCode<Status>, string> : TypedResponse<JSONParsed<ExtractContent<R['responses'][Status]['content']>>, ExtractStatusCode<Status>, 'json' | 'text'>;
73
73
  }[keyof R['responses'] & RouteConfigStatusCode];
74
74
  type Hook<T, E extends Env, P extends string, R> = (result: {
75
+ target: keyof ValidationTargets;
76
+ } & ({
75
77
  success: true;
76
78
  data: T;
77
79
  } | {
78
80
  success: false;
79
81
  error: ZodError;
80
- }, c: Context<E, P>) => R;
82
+ }), c: Context<E, P>) => R;
81
83
  type ConvertPathType<T extends string> = T extends `${infer Start}/{${infer Param}}${infer Rest}` ? `${Start}/:${Param}${ConvertPathType<Rest>}` : T;
82
84
  type OpenAPIHonoOptions<E extends Env> = {
83
85
  defaultHook?: Hook<any, E, any, any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hono/zod-openapi",
3
- "version": "0.16.1",
3
+ "version": "0.16.3",
4
4
  "description": "A wrapper class of Hono which supports OpenAPI.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -52,7 +52,7 @@
52
52
  },
53
53
  "dependencies": {
54
54
  "@asteasolutions/zod-to-openapi": "^7.1.0",
55
- "@hono/zod-validator": "0.2.2"
55
+ "@hono/zod-validator": "0.3.0"
56
56
  },
57
57
  "engines": {
58
58
  "node": ">=16.0.0"