_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",[2919,2922],{"name":2920,"color":2921},"🙋♂️ help wanted","008672",{"name":2923,"color":2924},"💬 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.64791197,{"description":2931,"labels":2932,"number":2938,"owner":2857,"repository":2858,"state":2903,"title":2939,"updated_at":2940,"url":2941,"score":2942},"## 🚘 v1.0.0 Roadmap\r\n\r\n### 🏠 House keeping\r\n\r\n- [x] Write `v0` -> `v1` migration guide. (currently maintained here https://github.com/jlalmes/trpc-openapi/pull/143)\r\n\r\n### 🚀 Definite\r\n\r\n- [x] Support tRPC `v10`. (https://github.com/jlalmes/trpc-openapi/issues/73)\r\n- [x] Remove response wrapper (https://github.com/jlalmes/trpc-openapi/pull/144)\r\n- [x] Add CORS setup to examples. (https://github.com/jlalmes/trpc-openapi/pull/122)\r\n- [x] Deprecate `meta.tag` (use `meta.tags` instead). (https://github.com/jlalmes/trpc-openapi/pull/92)\r\n- [x] Default to `enabled: true` when `meta.openapi` is defined. (https://github.com/jlalmes/trpc-openapi/issues/68)\r\n- [x] Fix YAML file `$refs`. (https://github.com/jlalmes/trpc-openapi/issues/37)\r\n- [x] Allow `method: 'DELETE'` in `mutation` procedures. (https://github.com/jlalmes/trpc-openapi/pull/123)\r\n- [x] Add `meta.headers`. (https://github.com/jlalmes/trpc-openapi/issues/113)\r\n- [x] Support `z.refine()`. (https://github.com/jlalmes/trpc-openapi/pull/102)\r\n- [x] Performance improvements. (https://github.com/jlalmes/trpc-openapi/pull/125)\r\n- [x] #156\r\n\r\n### 🤔 Maybe\r\n- [ ] Support `z.number()` query input. (https://github.com/jlalmes/trpc-openapi/issues/44)\r\n- [ ] Support `z.boolean()` query input. (https://github.com/jlalmes/trpc-openapi/issues/44)\r\n- [ ] Support `z.date()` query input. (https://github.com/jlalmes/trpc-openapi/issues/44)\r\n- [ ] Support `z.array()` query inputs. (https://github.com/modtree/modtree/pull/358#discussion_r929558840)\r\n- [ ] Add model schemas to OpenAPI document. (https://github.com/jlalmes/trpc-openapi/issues/157)\r\n- [ ] Add `Fastify` adapter. (https://github.com/jlalmes/trpc-openapi/issues/87)\r\n- [x] Add `Lambda` adapter. (https://github.com/jlalmes/trpc-openapi/issues/115)\r\n- [ ] Add `meta.examples`.\r\n- [ ] Add `override` object to `OpenApiMeta` and `GenerateOpenApiDocumentOptions`.\r\n\r\n### 🏋️♀️ Stretch\r\n- [ ] Support non-`z.object()` input.\r\n - Input is mandated as `z.object()` if using `pathParameters`.\r\n - Query input should be `?input=`.\r\n- [ ] Remove `output` schema requirement. (https://github.com/jlalmes/trpc-openapi/issues/61#issuecomment-1180611408)\r\n- [ ] Remove `zod` validator requirement.",[2933,2935],{"name":2934,"color":2921},"help wanted",{"name":2936,"color":2937},"roadmap","D33017",91,"🚘 v1.0.0 Roadmap","2022-11-27T13:56:32Z","https://github.com/trpc/trpc-openapi/issues/91",0.6562974,{"description":2944,"labels":2945,"number":2952,"owner":2857,"repository":2857,"state":2903,"title":2953,"updated_at":2954,"url":2955,"score":2956},"### Describe the feature you'd like to request\r\n\r\nAdd a simpler alternative way to define procedures.\r\n\r\n\r\nThis is the current way of doing it:\r\n\r\n```ts\r\nimport { publicProcedure, router } from './trpc';\r\nimport { z } from 'zod';\r\n \r\nexport const appRouter = router({\r\n hello: publicProcedure\r\n .input(\r\n z\r\n .object({\r\n text: z.string(),\r\n })\r\n .optional(),\r\n )\r\n .query(({ input }) => {\r\n return {\r\n greeting: `hello ${input?.text ?? 'world'}`,\r\n };\r\n }),\r\n});\r\n\r\n```\r\n\r\n### Describe the solution you'd like to see\r\n\r\nMost of the time, I use some sort of base procedure that does all the authz/authn, and end up just doing `.input(x).query(() => { /*...*/} )` etc at the end.\r\n\r\nHere I'm proposing to **adding** an alternative way of defining procedures that I think is a bit more readable:\r\n\r\n```ts\r\nimport { publicProcedure, router } from './trpc';\r\nimport { z } from 'zod';\r\n\r\nexport const appRouter = router({\r\n hello: publicProcedure.query({\r\n input: z\r\n .object({\r\n text: z.string(),\r\n })\r\n .optional(),\r\n resolve({ input }) {\r\n return {\r\n greeting: `hello ${input?.text ?? 'world'}`,\r\n };\r\n },\r\n }),\r\n});\r\n```\r\n\r\n### Desribe alternate solutions\r\n\r\n- There's maybe some alternative way of addressing this\r\n- This is very much a nice-to-have. \r\n- Maybe it can be a bit misleading to have two ways of doing things\r\n\r\n### Additional information\r\n\r\n- Related: #2940\r\n- `input` should not be required\r\n- Needs to work when the base procedures have existing input parsers\r\n- If someone wants to pick this up, I'll happily provide a test suite to work against\r\n\r\n### 👨👧👦 Contributing\r\n\r\n- [X] 🙋♂️ Yes, I'd be down to file a PR implementing this feature!",[2946,2949],{"name":2947,"color":2948},"@trpc/server","9BE78E",{"name":2950,"color":2951},"RFC","78B062",2975,"feat: Add alternative way to create procedures","2022-10-13T13:29:56Z","https://github.com/trpc/trpc/issues/2975",0.6584798,["Reactive",2958],{},["Set"],["ShallowReactive",2961],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$fjJ20IjGKIFwcnuyGB7h7t0Qrbtmwfl3Z22F4F3U8EqY":-1},"/trpc/trpc-openapi/261"]