Entity checklist
Every decision one #[expose]d entity asks of you, one line each, each pointing at the page that explains it.
One #[expose] declaration feeds the REST body, the GraphQL type, the OpenAPI
schema, the CRUD inputs and each wire row’s judgement. That is the framework’s densest
payoff and its densest set of choices — and they are documented across four
pages, because each belongs beside the mechanism it drives.
This page is the list. One line per decision, and a link to where it is explained. Read it when you declare your second entity; the first one you copy from Entities.
On the entity
Section titled “On the entity”#[expose(name = "Post", service = …, graphql, timestamps, soft_delete)]| Argument | Ask yourself | Reference |
|---|---|---|
name |
What is this type called on the wire? Bare, no suffix | Entities |
service |
Which CrudService owns it? Omit for a read-only exposure with none |
CRUD |
graphql |
Does it appear in the schema, or is it HTTP-only? | GraphQL |
timestamps |
Should created_at / updated_at be maintained for you? |
Lifecycle columns |
soft_delete |
Does DELETE tombstone the row instead of erasing it? |
Lifecycle columns |
complex |
Does the wire type need a hand-written #[ComplexObject] field resolver? |
Field resolvers |
On each field
Section titled “On each field”| Argument | Ask yourself | Reference |
|---|---|---|
#[expose] |
Does this column cross the wire at all? Silence means hidden | Entities |
input(create, update) |
May a client write it, and on which operation? | CRUD |
validate(…) |
What makes a value of it invalid at the edge? | Pipes |
default = … |
Is it a constant the server decides, stored when an insert leaves it unset? | Entity inputs |
via = "…" |
On a has_many, which of the child’s foreign keys does it follow? |
Entities |
complexity = … |
Does resolving it cost more than a column read? | Field complexity |
An enum column takes #[wire_enum] — it
carries the wire derives, so the field can be #[expose]d like any scalar.
What fails on its own, and how loudly
Section titled “What fails on its own, and how loudly”One trap on this page announces itself at compile time, the other only at runtime, and the difference matters when you are deciding what to test:
- A grant withholding a column no
nullanswers is refused when the ability builds, naming the column: a grant onReadmay leave out only anOptioncolumn or one#[expose(nullable)]declares. A unit test building each role’s ability catches it before a request does. - A unique column on a
soft_deletetable answers409for a value every read calls free, when its index is a full one: index itWHERE deleted_at IS NULL. See Lifecycle columns.
The two you carry yourself
Section titled “The two you carry yourself”Is every column that should be hidden actually unexposed? Exposure is
opt-in, so a column added by a later migration never leaks by omission — the
failure direction is the safe one. The remaining risk is the reverse: an
#[expose] written by habit on a column that should not travel.
Does a push carry the row, or a wire row someone else built? A wire row is
judged on its whole row where it is built, hidden columns included, so a rule
reading one decides it. A subscription builds its rows as the socket polls its
stream, each judged for its subscriber: carry the Model on the event and build
the wire row in the stream — a wire row the publisher built answers no
subscriber, see
A row answers the caller who judged it.
Going further
Section titled “Going further”- Entities — the full
#[expose]grammar. - CRUD — what the service half owes each argument.
- Response masking — what the exposed set means once a policy is in play.