diff --git a/.changeset/slimy-singers-begin.md b/.changeset/slimy-singers-begin.md new file mode 100644 index 00000000..ac4a4ddf --- /dev/null +++ b/.changeset/slimy-singers-begin.md @@ -0,0 +1,5 @@ +--- +'@hono/zod-openapi': patch +--- + +properly convert openapi path type to hono diff --git a/packages/zod-openapi/src/index.ts b/packages/zod-openapi/src/index.ts index 04362b44..4ba8d745 100644 --- a/packages/zod-openapi/src/index.ts +++ b/packages/zod-openapi/src/index.ts @@ -145,8 +145,8 @@ type Hook = ( c: Context ) => TypedResponse | Promise> | void -type ConvertPathType = T extends `${infer _}/{${infer Param}}${infer _}` - ? `/:${Param}` +type ConvertPathType = T extends `${infer Start}/{${infer Param}}${infer Rest}` + ? `${Start}/:${Param}${ConvertPathType}` : T type HandlerResponse = TypedResponse | Promise>