From b70735cc6c21d0a3bea6a0e45f0783adda3d0927 Mon Sep 17 00:00:00 2001 From: Yann Normand Date: Sun, 30 Mar 2025 12:04:13 +1000 Subject: [PATCH] docs:(zod-openapi): add note about app.route (#1088) --- packages/zod-openapi/README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/zod-openapi/README.md b/packages/zod-openapi/README.md index dd3d874b..01c83b6f 100644 --- a/packages/zod-openapi/README.md +++ b/packages/zod-openapi/README.md @@ -472,6 +472,18 @@ Be careful when combining `OpenAPIHono` instances with plain `Hono` instances. ` If you're migrating from plain `Hono` to `OpenAPIHono`, we recommend porting your top-level app, then working your way down the router tree. +When using the `.route()` method to mount a child OpenAPIHono app that uses path parameters, you should use the Hono *:param* syntax in the parent route path, rather than the OpenAPI *{param}* syntax: + +``` +const bookActionsApp = new OpenAPIHono() +... +// ❌ Incorrect: This will not match the route +app.route('/books/{bookId}', bookActionsApp) + +// ✅ Using Hono parameter syntax +app.route('/books/:bookId', bookActionsApp) +``` + ### Header keys Header keys that you define in your schema must be in lowercase.