feat(zod-openapi): add target property to parameter of validation hook (#756)

* feat(zod-openapi): add target property to parameter of validation hook

Signed-off-by: Luca Schultz <github@lucaschultz.com>

* add changeset

---------

Signed-off-by: Luca Schultz <github@lucaschultz.com>
Co-authored-by: Yusuke Wada <yusuke@kamawada.com>
pull/761/head
Luca Schultz 2024-10-03 12:13:19 +02:00 committed by GitHub
parent 09bb26fccf
commit f6d642afdd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 2 deletions

View File

@ -0,0 +1,5 @@
---
'@hono/zod-openapi': patch
---
fix: add target property to parameter of validation hook

View File

@ -185,7 +185,7 @@ export type RouteConfigToTypedResponse<R extends RouteConfig> = {
}[keyof R['responses'] & RouteConfigStatusCode]
export type Hook<T, E extends Env, P extends string, R> = (
result:
result: { target: keyof ValidationTargets } & (
| {
success: true
data: T
@ -193,7 +193,8 @@ export type Hook<T, E extends Env, P extends string, R> = (
| {
success: false
error: ZodError
},
}
),
c: Context<E, P>
) => R