Skip to content

Commit

Permalink
fix(zod-openapi): properly convert openapi path type to hono (#182)
Browse files Browse the repository at this point in the history
* fix: properly convert openapi path type to hono

* chore: add changeset
  • Loading branch information
ZerNico authored Sep 28, 2023
1 parent d4ae60d commit 9aefddc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/slimy-singers-begin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hono/zod-openapi': patch
---

properly convert openapi path type to hono
4 changes: 2 additions & 2 deletions packages/zod-openapi/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ type Hook<T, E extends Env, P extends string, O> = (
c: Context<E, P>
) => TypedResponse<O> | Promise<TypedResponse<T>> | void

type ConvertPathType<T extends string> = T extends `${infer _}/{${infer Param}}${infer _}`
? `/:${Param}`
type ConvertPathType<T extends string> = T extends `${infer Start}/{${infer Param}}${infer Rest}`
? `${Start}/:${Param}${ConvertPathType<Rest>}`
: T

type HandlerResponse<O> = TypedResponse<O> | Promise<TypedResponse<O>>
Expand Down

0 comments on commit 9aefddc

Please sign in to comment.