docs(openapi): note that prefixes now apply to every procedure - #1971
Conversation
In v1, `.prefix` was a no-op for procedures without a `path`, so those endpoints kept the bare router-derived path. In v2 the prefix is merged onto the derived path too, silently moving every such endpoint. The migration guide now calls this out with a v1/v2 comparison, and lists it alongside the other changes that need attention before upgrading.
More templates
@orpc/ai-sdk
@orpc/arktype
@orpc/bun
@orpc/client
@orpc/cloudflare
@orpc/contract
@orpc/experimental-effect
@orpc/evlog
@orpc/hibernation
@orpc/json-schema
@orpc/experimental-msw
@orpc/nest
@orpc/next
@orpc/node
@orpc/openapi
@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: |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
orpc | 9024b60 | Commit Preview URL Branch Preview URL |
Sep 01 2026, 02:31 AM |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Add a "Read these first" checklist item noting that
.prefix/prefixnow applies to every procedure, not only those that define apath. - Add a
:::warning[Prefixes now apply to every procedure]callout with a v1/v2<CodeGroup>example showing a pathlessplanet.createunder a/api/v2prefix.
I verified the two behavioral claims against the source rather than trusting the description: the v1 matcher used route.path ?? toHttpPath(path) and prefixRoute returns the route untouched when path is unset (confirmed in v1 packages/contract/src/route.ts, pre-v2 commit), while v2 computes meta.path ?? pathToHttpPath(path) first and then merges the prefix (packages/openapi/src/openapi-generator.ts:131-132). The example paths (POST /planet/create vs POST /api/v2/planet/create), the default POST method, and both link targets (#basic-routing in apps/content/docs/openapi/routing.mdx, #routing-moved-to-openapi-metadata in from-v1.mdx) all check out.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

In v1,
.prefixwas a no-op for procedures that did not define apath, so those endpoints kept the bare router-derived path. In v2 the prefix is merged onto the derived path as well, which silently moves every such endpoint. Nothing in the migration guide said so, and the change is invisible until a client 404s.Docs
The "Routing Moved to OpenAPI Metadata" section now carries a warning with a side-by-side example: the same pathless
planet.createisPOST /planet/createunder a v1.prefix('/api/v2')andPOST /api/v2/planet/createin v2. The change is also listed in the "Read these first" callout at the top of the page, next to the other upgrades that break at runtime rather than at compile time.Verification
Confirmed against both versions rather than from memory: v1's
prefixRoutereturns the route untouched whenpathis unset, while v2 computesmeta.path ?? pathToHttpPath(path)first and merges the prefix onto the result. A scratch test againstOpenAPIGeneratorproducedPOST /api/v2/planet/createfor the documented example.