domain only.Expand description
Where ash-domain plugs in — optional, behind the domain feature.
This crate stands alone: resource! over your own
structs and storage needs no ash-* crate in the tree at all. This module
is the other way in, for a service whose resources the domain already
owns.
The division: the domain owns resources, policies and execution; this
crate owns the JSON:API wire format. Nothing about a resource is declared
twice — attributes, types, relationships and cardinality all come from
#[derive(Resource)], and the one thing supplied here is the base path,
because the domain does not know it is being served over HTTP.
impl DomainState for App { /* domain, context, mounted schemas */ }
ash_jsonapi::domain_resource! { Todo as "todo" at "/todos", state: App }
ash_jsonapi::api! { operations: [ash_jsonapi::CRUD], resource: Todo, … }domain_resource! writes the same traits
resource! does, so api! serves both
kinds of resource identically. Every action runs through the domain —
Bound, not around it — so policies,
extensions and validation all apply, and error_from turns what comes
back into the right status: a denial is a 403, not a 500.
Structs§
- Domain
Input - A request body on its way to the domain.
- Mounted
- A resource schema paired with the path it is served under.
- Mounted
Schemas - The schemas a
DomainStateserves, resolved once at startup. - Probe
- A
page_querythat reads one row past the page.
Traits§
- Domain
State - Your state, as the
ash-domainbridge sees it.
Functions§
- error_
from - An
ash-domainerror, as a JSON:API error. - listing_
from httpandvalidation - The rows of a
probe_queryas aListing. - page_
query - A JSON:API collection request as a domain
Query. - probe_
query - A collection request as a domain query that reads one row too many.