Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions apps/content/docs/migrations/from-v1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,28 @@ const router = {

</CodeGroup>

### Path parameter syntax (`/{id}` vs `/:id`)

In v2, OpenAPI path parameters strictly require curly brace syntax (`/{id}`). Express-style colon parameters (`/:id`) are no longer converted automatically and are treated as literal static paths, causing path parameter parsing and input validation to fail.

<CodeGroup>

```ts v2
import { openapi } from '@orpc/openapi'

const getPlanet = os
.meta(openapi({ method: 'GET', path: '/planets/{id}' }))
.input(z.object({ id: z.string() }))
```

```ts v1
const getPlanet = os
.route({ method: 'GET', path: '/planets/:id' })
.input(z.object({ id: z.string() }))
```

</CodeGroup>

## Procedure Builder

### `.callable` is no longer built in
Expand Down
4 changes: 4 additions & 0 deletions apps/content/docs/openapi/routing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ const getFile = os
.input(z.object({ path: z.string() }))
```

:::warning
Path parameters strictly require OpenAPI curly brace syntax (`/{name}`). Express-style colon parameters (`/:name`) are treated as literal static paths and will not extract path parameters into procedure input.
:::

:::info
To customize path parameter encoding and decoding, see [Path Parameter Styles](/docs/openapi/input-and-output-mapping#path-parameter-styles).
:::
Expand Down