Skip to content

Commit f6d642a

Browse files
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>
1 parent 09bb26f commit f6d642a

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

.changeset/purple-lizards-change.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@hono/zod-openapi': patch
3+
---
4+
5+
fix: add target property to parameter of validation hook

packages/zod-openapi/src/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,15 +185,16 @@ export type RouteConfigToTypedResponse<R extends RouteConfig> = {
185185
}[keyof R['responses'] & RouteConfigStatusCode]
186186

187187
export type Hook<T, E extends Env, P extends string, R> = (
188-
result:
188+
result: { target: keyof ValidationTargets } & (
189189
| {
190190
success: true
191191
data: T
192192
}
193193
| {
194194
success: false
195195
error: ZodError
196-
},
196+
}
197+
),
197198
c: Context<E, P>
198199
) => R
199200

0 commit comments

Comments
 (0)