_e.g._ `?input=${JSON.stringify(encodeURIComponent(input))` |\r\n| `POST` | `.mutation()` | Input as post body. | \r\n\r\n## Considerations with OpenAPI\r\n\r\n- Resources are usually `/{resource}/{id}?param1=x¶m2=y`-style - tRPC is [currently] with `{resource}?input=JSON.stringify(encodeURIComponent(input))`-style\r\n- JSON-RPC based response shape might not be the ideal response shape for OpenAPI\r\n- An output schema usually have a `$ref`-schema which would be possible to do automatically / first feature people would request is to make different paths request the same input type\r\n- Actually using zod or any other validation on a resolver's `output` would slow down API outputs.\r\n\r\n## Related\r\n\r\nhttps://github.com/trpc/trpc/discussions/271\r\n",[2895,2897],{"name":2896,"color":2885},"🙋♂️ help wanted",{"name":2898,"color":2899},"💬 discussion","4B318A",755,"[RFC] Using tRPC for public-facing APIs (OpenAPI/Swagger/etc)","2022-06-19T00:48:45Z","https://github.com/trpc/trpc/issues/755",0.7065687,{"description":2906,"labels":2907,"number":2908,"owner":2853,"repository":2854,"state":2887,"title":2909,"updated_at":2910,"url":2911,"score":2912},"In my of our endpoints we don't include the Output definition because it's automatically inferred by tRPC.\r\n\r\nWe feel like it's a step backwards having to define the output each time.\r\n\r\n```\r\nexport const health = publicProcedure\r\n .meta({ openapi: { method: 'POST', path: '/health', tags: ['admin'], protect: false } })\r\n .input(\r\n z.void(),\r\n //\r\n )\r\n .output(z.any()) \u003C\u003C This is not needed. tRPC knows the type without it.\r\n .mutation(async ({ ctx, input }) => {\r\n return { status: nanoid(9) };\r\n });\r\n\r\n```",[],216,"Feature: Infer type from output","2022-12-30T14:41:18Z","https://github.com/trpc/trpc-openapi/issues/216",0.7082932,{"description":2914,"labels":2915,"number":2916,"owner":2853,"repository":2854,"state":2887,"title":2917,"updated_at":2918,"url":2919,"score":2920},"Hey Guys\r\n\r\nI've started using the T3 Stack with trpc / nextjs and wanted to use this awesome package to my Project.\r\nEverything works fine and I see the OpenAPI-Docs in the expected route. But i dont understand why this happens\r\n\r\nWhen looking at my trpc query, I have the following:\r\n```ts\r\nexport const exampleRouter = createRouter().query(\"hello\", {\r\n meta: { openapi: { enabled: true, method: \"GET\", path: \"/api/trpc/example.hello\" } },\r\n input: z.object({ name: z.string() }),\r\n output: z.object({ greeting: z.string() }),\r\n resolve: ({ input }) => {\r\n return { greeting: `Hello ${input.name}!` };\r\n },\r\n});\r\n```\r\nwhich generated the OpenAPI docs but when i try to execute it throught the UI it generates the URL like this:\r\n`http://0.0.0.0:3000/api/trpc/example.hello?name=asdf` which is of course not wrong. But when looking into the dev-tools on my page the request generated from trpc-client is generated like this:\r\n`http://localhost:3000/api/trpc/example.hello?batch=1&input={\"0\":{\"json\":{\"name\":\"jerome\"}}}`\r\n\r\nCan i change this behavior for the generation of the OpenAPI docs or how would you recommend trying to fix this?\r\n\r\nThanks in advanced\r\nJerome",[],149,"[Help wanted] T3 Stack and Queryparameters","2023-06-08T11:28:37Z","https://github.com/trpc/trpc-openapi/issues/149",0.7098633,{"description":2922,"labels":2923,"number":2924,"owner":2853,"repository":2854,"state":2887,"title":2925,"updated_at":2926,"url":2927,"score":2928},"Output validation is required by `trpc-openapi` to generate the valid response schema, but then maybe we don't really want to enable runtime output validation for our procedures.\r\n\r\nI'm not sure what would be the ideal solution here.\r\n\r\nIs there any way to ignore the runtime output validation?",[],202,"Option to ignore output validation?","2022-12-14T15:41:40Z","https://github.com/trpc/trpc-openapi/issues/202",0.71795195,{"description":2930,"labels":2931,"number":2932,"owner":2853,"repository":2854,"state":2887,"title":2933,"updated_at":2934,"url":2935,"score":2936},"I have set up two routes in order to see how trpc-openapi generated error responses in the spec file, but I can't seem to get it to work.\r\n\r\nHere is the resulting spec:\r\n```yaml\r\n/error/bad-request:\r\n get:\r\n operationId: query.error.badRequest\r\n parameters: []\r\n responses:\r\n '200':\r\n description: Successful response\r\n content:\r\n application/json:\r\n schema: {}\r\n default:\r\n $ref: '#/components/responses/error'\r\n /error/too-many-requests:\r\n get:\r\n operationId: query.error.tooManyRequests\r\n parameters: []\r\n responses:\r\n '200':\r\n description: Successful response\r\n content:\r\n application/json:\r\n schema: {}\r\n default:\r\n $ref: '#/components/responses/error'\r\n```\r\n\r\nAnd here is the TypeScript definition:\r\n\r\n```ts\r\nimport { z } from \"zod\";\r\n\r\nimport { createTRPCRouter, publicProcedure } from \"../trpc\";\r\nimport { TRPCError } from \"@trpc/server\";\r\n\r\nexport const errorRouter = createTRPCRouter({\r\n badRequest: publicProcedure\r\n .meta({\r\n openapi: {\r\n method: \"GET\",\r\n path: \"/error/bad-request\",\r\n },\r\n })\r\n .input(z.void())\r\n .output(z.void())\r\n .query(() => {\r\n throw new TRPCError({\r\n code: \"BAD_REQUEST\",\r\n message: \"Bad request\",\r\n });\r\n }),\r\n tooManyRequests: publicProcedure\r\n .meta({\r\n openapi: {\r\n method: \"GET\",\r\n path: \"/error/too-many-requests\",\r\n },\r\n })\r\n .input(z.void())\r\n .output(z.void())\r\n .query(() => {\r\n throw new TRPCError({\r\n code: \"TOO_MANY_REQUESTS\",\r\n message: \"Too many requests\",\r\n });\r\n }),\r\n});\r\n```\r\n\r\nUsing cURL on the REST endpoints, I can see that the proper response codes are returned, but I don't understand why that doesn't show up in the spec. Is that intended behaviour, or do I need to do something different?",[],258,"Next.js adapter doesn't generate error status codes in openapi.json","2023-03-03T11:02:30Z","https://github.com/trpc/trpc-openapi/issues/258",0.718507,{"description":2938,"labels":2939,"number":2946,"owner":2853,"repository":2853,"state":2887,"title":2947,"updated_at":2948,"url":2949,"score":2950},"Originally posted by @KATT \r\n\r\n> See @jlalmes' PR https://github.com/trpc/trpc/pull/1759\r\n> \r\n> Potential things. Not definitive, just ideas.\r\n> \r\n> \r\n> ## Remove unused fields\r\n> \r\n> Before:\r\n> \r\n> ```js\r\n> [\r\n> {\r\n> \"id\": null,\r\n> \"result\": {\r\n> \"type\": \"data\",\r\n> \"data\": {\r\n> \"id\": \"1\",\r\n> \"title\": \"Hello tRPC\",\r\n> \"body\": \"...\"\r\n> // ...\r\n> }\r\n> }\r\n> },\r\n> ]\r\n> ```\r\n> \r\n> After:\r\n> \r\n> ```js\r\n> [\r\n> {\r\n> \"result\": {\r\n> \"data\": {\r\n> \"id\": \"1\",\r\n> \"title\": \"Hello tRPC\",\r\n> \"body\": \"...\"\r\n> // ...\r\n> }\r\n> }\r\n> },\r\n> ]\r\n> ```\r\n> \r\n> ## Changed response to a mapped object\r\n> \r\n> Potential ease of allowing for streaming... maybe we could start sending response as procedures are finalised and not wait for _all of them_ to be finalized before returning... but it also breaks HTTP-codes so not sure.\r\n> \r\n> Probably not a good idea, just a thought\r\n> \r\n> ```js\r\n> {\r\n> // 0 means index 0 of the batch\r\n> \"0\": { \r\n> \"id\": null,\r\n> \"result\": {\r\n> \"type\": \"data\",\r\n> \"data\": {\r\n> \"id\": \"1\",\r\n> \"title\": \"Hello tRPC\",\r\n> \"body\": \"...\"\r\n> // ...\r\n> }\r\n> }\r\n> },\r\n> ]\r\n> ```\r\n> \r\n> ## Remove JSONRPC \r\n> \r\n> Remove JSNORPC stuff on the request/response for internal requests...\r\n> \r\n> ",[2940,2943],{"name":2941,"color":2942},"💡 ideas","bfdadc",{"name":2944,"color":2945},"next-major/maybe","D4C5F9",1778,"Simplify tRPC Request/Response/Message Interfaces","2022-10-04T12:03:12Z","https://github.com/trpc/trpc/issues/1778",0.72647464,["Reactive",2952],{},["Set"],["ShallowReactive",2955],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$fRz7MqiHDfv4B5wJ1bl9W_Lw-skRwm7FH62SYwjyMGmM":-1},"/trpc/trpc-openapi/269"]