Paths and placeholders
A placeholder in a path is typed where it appears, and reaches what the route runs by its name:
PATCH /{todo_id: Todo.id} { input: PatchTodo output: TodoView run: patch_todo(todo_id, input, current_principal.user)}
Here {todo_id: Todo.id} reads one segment of the path as a todo's id and
passes it to patch_todo as todo_id.
- A placeholder's type is a named type
over a scalar, or an entity's id (
X.id). It is never optional. - The segment is decoded once and checked. A bad value is a 422, like any bad input.
- The methods are
GET,POST,PUT,PATCHandDELETE. The runtime answersHEADandOPTIONSitself. - Two routes that could match the same request, such as
/{todo_id: Todo.id}and/{slug: Slug}, are an error. A fixed segment wins over a placeholder, soGET /archivedcan sit besideGET /{todo_id: Todo.id}.
Markdown for agents: /docs/paths-and-placeholders.md.Built from Jadpo main at a707efb.