Skip to content

Commit f821372

Browse files
committed
fix: Remove trailing slashes from openapi docs
1 parent 2e484bf commit f821372

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/open-api.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ export function buildOpenApiDocs(
3535
};
3636
for (const [method, methodEntry] of Object.entries(app["~zeta"].routes)) {
3737
for (const [path, routerData] of Object.entries(methodEntry)) {
38-
const openApiPath = path.replace(/\/:([^/]+)/g, "/{$1}");
38+
const openApiPath = path
39+
// Replace parameters with OpenAPI format
40+
.replace(/\/:([^/]+)/g, "/{$1}")
41+
// Remove trailing slash
42+
.replace(/\/$/, "");
3943
const { headers, params, query, body, responses, ...openApiOperation } =
4044
routerData.def ?? {};
4145
docs.paths ??= {};

0 commit comments

Comments
 (0)