# Paths and placeholders

A placeholder in a path is typed where it appears, and reaches what the
route runs by its name:

```jadpo
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](named-types.md)
  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`, `PATCH` and `DELETE`. The runtime
  answers `HEAD` and `OPTIONS` itself.
- 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, so `GET /archived` can sit beside
  `GET /{todo_id: Todo.id}`.
