Read mask
rn_forge.fastapi.read_mask
FastAPI dependency and helper for the readMask query parameter.
masked(page, mask)
Return the wire body of page with mask applied to each of its items.
nextPageToken and totalSize are left alone. With no mask the body is
the page's own.
read_mask_param(model)
Return a dependency yielding the parsed readMask, or None for the whole resource.
The declared fields are model's serialization aliases, including its
computed fields. A field typed as a model, Model | None or list[Model]
is a nested object whose own fields can be selected; any other field,
including a dict, is a leaf. A path that names no declared field, or
that combines * with other paths, is a 400 before the route runs.
Apply the result with mask.apply(body) to a dumped resource, or with
:func:masked to a page.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
type[BaseModel]
|
The model of one resource, as the route serves it. |
required |