Expand description
Shared query helpers for the v2 API.
Pagination caps, sparse-field selection, and the meta envelope.
Structs§
- Detail
Fields - The query a detail endpoint accepts.
- List
Envelope - The standard list envelope:
{ meta: { total_count, limit, offset }, items: [...] }. - List
Meta - List
Query - Common query parameters that work across every list endpoint.
- Order
Spec (direction, field)parsed from oneorder=segment.- Path
axum::extract::Path, rejecting in JSON.- Query
axum::extract::Query, rejecting in JSON.
Constants§
- DEFAULT_
LIMIT - Default page size when
?limit=is omitted. - MAX_
LIMIT - Hard cap on
?limit=. Beyond this, slow clients can DoS the cms with one request.
Functions§
- apply_
fields - Apply a sparse-field filter in place.
metaandidare always preserved so consumers can still walk the response. - clamp_
limit - Clamp a requested page size into
1..=MAX_LIMIT, defaulting when absent. Shared so every list endpoint agrees on the bounds — the menus list previously re-derived them and could have drifted. - clamp_
page_ size - The page-size rule, for a surface with its own bounds (the MCP tools
allow larger pages than the public API):
defaultwhen absent, else clamped into1..=max. - empty_
as_ none - Deserialize an optional query parameter, treating an empty value as absent.
- empty_
string_ as_ none - Like
empty_as_nonefor string parameters:?locale=means “not specified”, never the locale whose code is the empty string. - field_
set - Parsed sparse-field selector.
Nonemeans “no selection — return every field”;Some(set)means “only these top-level keys”. - paginate
- Clamped
(limit, offset)from aListQuery. - parse_
order - Parse
?order=into a vector ofOrderSpecs in declaration order. Empty input → empty vec (caller falls back to its default). - parse_
order_ in - Parse
?order=, refusing a field this endpoint cannot sort by. - parse_
updated_ since - Parse
?updated_since=as RFC 3339. - validate_
fields - Refuse a
?fields=name the serializer never emits.