jlalmes / trpc-openapi

OpenAPI support for tRPC 🧩
https://www.npmjs.com/package/trpc-openapi
MIT License
2.18k stars 147 forks source link

encoded path params are not parsed correctly #436

Closed squishy-kf closed 4 months ago

squishy-kf commented 8 months ago

First of all thanks for creating this, it's removed alot of difficult convo's when moving to trpc first api.

Now for the bug. I have a path param that that is url encoded but when i try and pass it into my openAPI route it treats both parts of the param (either side of the encoded slack) as different path params.

this will error if called with an id of 'hello%2Fworld' export const test = trpc.procedure .meta({ openapi: { method: 'GET', path: '/test/{id}' } }) .input( z.object({ id: z.string(), }), ) .output(z.string()) .query(async ({ input }) => { return input.id; });

squishy-kf commented 4 months ago

spent far too long staring at the same problem. this is not an issue with this package but with aws SAM. sorry for the noise.