Repository navigation
fix(trpc): carry every chained tRPC input schema into the oRPC procedure - #2542
Conversation
More templates
@orpc/ai-sdk
@orpc/arktype
@orpc/bun
@orpc/client
@orpc/cloudflare
@orpc/contract
@orpc/effect
@orpc/evlog
@orpc/hibernation
@orpc/json-schema
@orpc/experimental-lock
@orpc/mcp
@orpc/msw
@orpc/nest
@orpc/next
@orpc/node
@orpc/openapi
@orpc/experimental-openapi-inference
@orpc/opentelemetry
@orpc/pinia-colada
@orpc/pino
@orpc/publisher
@orpc/ratelimit
@orpc/server
@orpc/shared
@orpc/swr
@orpc/tanstack-query
@orpc/trpc
@orpc/valibot
@orpc/zod
commit: |
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
✅ No new issues found.
Approach: sound — expose every chained input schema on the converted procedure and let the existing oRPC machinery handle the list, instead of merging schemas inside the adapter.
Reviewed changes — the full 3-file diff at d41493df, plus local verification (pnpm vitest run packages/trpc packages/contract, tsc --noEmit -p packages/trpc, oxlint, oxfmt --check).
- Every chained input carried over —
toORPCProceduremaps each entry of_def.inputsthroughtoStandardSchemaand filters, soinputSchemasholds all chained Standard Schemas rather than only.at(-1). - Non-standard parsers unchanged — function parsers are still dropped, and an empty result still yields
undefined, so procedures without Standard Schema inputs keep their previous shape. - Generated spec stays coherent —
OpenAPIGenerator.convertSchemasalready composes multipleinputSchemaswithallOf, andextractJsonObjectSchemaEntriesmergesallOfbranches, so compact path/query/body splitting still works; a path param declared in an earlier input is now found instead of throwing "dynamic param is missing". - Docs — one sentence on the integration page states that every chained
.input()is carried over and validation stays in tRPC. - Tests — two- and three-input chains assert the contract, the generated request body, real calls (success and
BAD_REQUESTon a missing field), and skipping a non-standard parser.
The allOf representation is exact here because tRPC's createInputMiddleware validates every parser against getRawInput() and only then merges the parsed objects, so each chained schema constrains the same raw request body.
deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏
Merging this PR will not alter performance1 warning
Comparing Footnotes
|
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
orpc | d41493d | Commit Preview URL Branch Preview URL |
Nov 23 2026, 09:58 AM |

What
toORPCRouterbuilt the oRPC procedure's input schema from the last entry of tRPC's_def.inputsonly. A procedure with chained inputs,t.procedure.input(z.object({ x })).input(z.object({ y })), produced a contract and OpenAPI request body containing onlyy, while tRPC still validated both at runtime, so a request built from the generated spec failed onx.Every entry of
_def.inputsthat is a Standard Schema is now passed asinputSchemas, which the OpenAPI generator combines withallOf.Notes for review
disableInputValidation: true), so tRPC remains the only validator and nothing is validated twice._def.output, replaced on each.output()call.Tests
Two and three chained inputs: the resulting contract, the generated OpenAPI request body, and real calls (success and
BAD_REQUESTon a missing field), plus skipping a non-standard parser.