Reference · by task
Build an API
Routes with one typed input and output, the failures callers see, and the OpenAPI document written for you. Read them in this order. Each page links to the pages around it.
- Route groups
Every route belongs to a route group: a
routesdeclaration with a name and aprefix:. - Paths and placeholders
A placeholder in a path is typed where it appears, and reaches what the route runs by its name:
- One input
A route reads at most one input, named by
input:. - Output and status
output:names what the route answers with: anOutputtype, an object made to be sent to clients. - What a route runs
run:calls one named action. - Declaring a failure
A failure is a way an action or query can fail that its caller is expected to handle, such as a todo that doesn't exist.
- Saying what can fail: fails
A function or action lists the failures it can end with after
fails, in its signature: - How failures reach the client
Every failure reaches the client in one envelope:
code,message,request_id, and the failure's client fields underdetails(Failures). - Idempotent writes
A client that retries a write after a timeout can't tell whether the first try worked.
- Time limits
Every route has a deadline: 10 seconds, unless
deadline:sets another, and never more than 60. - OpenAPI
The compiler writes one OpenAPI 3.1 document per API into
build/openapi/. - The public API record
Each API has a committed, readable record of its routes, fields and failure codes:
api/main.jadpo_recordformain.