Expand description
axum adapter for jsonapi_core.
This crate is a thin binding: it provides axum’s FromRequest /
FromRequestParts / IntoResponse impls, delegating all JSON:API logic to
jsonapi_http. If a type here grows real logic, it belongs in
jsonapi_http instead so other framework adapters can reuse it.
§Module map
error—JsonApiError, the shared rejection + error responder.response—JsonApiResponse, anIntoResponsewrapper for documents.extract—JsonApi,JsonApiQuery,JsonApiQueryValidatedextractors.normalize—not_foundfallback andNormalizeErrorsLayerto JSON:API-shape framework-generated error responses.request_id—RequestIdLayer+RequestIdextractor for correlation ids on error documents (errors[].id) and thex-request-idresponse header.
The framework-agnostic tower layers from jsonapi_http and the most-used
jsonapi_core types are re-exported so handler code can import from
jsonapi_axum alone.
Re-exports§
pub use error::IntoJsonApiError;pub use error::JsonApiError;pub use error::ResultExt;pub use extract::BaseUrl;pub use extract::JsonApi;pub use extract::JsonApiQuery;pub use extract::JsonApiQueryValidated;pub use extract::NegotiatedMediaType;pub use normalize::NormalizeErrorsLayer;pub use normalize::NormalizeErrorsService;pub use normalize::not_found;pub use pagination::pagination_links;pub use pagination::pagination_links_with_base;pub use relationship::JsonApiToMany;pub use relationship::JsonApiToOne;pub use relationship::RelationshipResponse;pub use request_id::RequestId;pub use request_id::RequestIdLayer;pub use request_id::RequestIdService;pub use response::JsonApiResponse;pub use jsonapi_core;
Modules§
- error
JsonApiError— the single error type used both as an extractorRejectionand as an error responder.- extract
- axum extractors for JSON:API requests.
- normalize
- JSON:API-shape framework-generated error responses.
- pagination
- Request-URI-aware pagination links.
- relationship
- Relationship-endpoint payloads.
- request_
id - Request-id / error-id correlation.
- response
JsonApiResponse— anIntoResponsewrapper that serializes aDocumentas a JSON:API response viajsonapi_http.
Structs§
- Accept
Layer - Rejects requests with no acceptable
Acceptmedia type with a406JSON:API error document (viacrate::request::negotiate). - ApiError
- Re-exports of the
jsonapi_coretypes most commonly needed to build handlers, so handler bodies can import fromjsonapi_axumalone. - ApiErrors
- Re-export the fluent
ApiErrorbuilder surface so handlers can construct JSON:API errors without importingjsonapi_httpdirectly. A small accumulator for building a JSON:APIerrorslist — collect oneApiErrorper problem (e.g. per invalid attribute), then turn the batch into a single errors document. - Content
Type Layer - Rejects requests whose
Content-Typeis notapplication/vnd.api+jsonwith a415JSON:API error document (viacrate::request::check_content_type). - Cursor
Links - Re-exports of the
jsonapi_coretypes most commonly needed to build handlers, so handler bodies can import fromjsonapi_axumalone. - Cursor
Page - Re-exports of the
jsonapi_coretypes most commonly needed to build handlers, so handler bodies can import fromjsonapi_axumalone. - Document
Builder - Re-exports of the
jsonapi_coretypes most commonly needed to build handlers, so handler bodies can import fromjsonapi_axumalone. - Json
ApiLayer - Combined guard applying both
ContentTypeLayerandAcceptLayerin one pass: content type is checked first, thenAcceptis negotiated. - Json
ApiMedia Type - Re-exports of the
jsonapi_coretypes most commonly needed to build handlers, so handler bodies can import fromjsonapi_axumalone. - Offset
Page - Re-exports of the
jsonapi_coretypes most commonly needed to build handlers, so handler bodies can import fromjsonapi_axumalone. - Page
Number Page - Re-exports of the
jsonapi_coretypes most commonly needed to build handlers, so handler bodies can import fromjsonapi_axumalone. - Page
Window - Re-exports of the
jsonapi_coretypes most commonly needed to build handlers, so handler bodies can import fromjsonapi_axumalone. - Query
- Re-exports of the
jsonapi_coretypes most commonly needed to build handlers, so handler bodies can import fromjsonapi_axumalone. - Relationship
- Re-exports of the
jsonapi_coretypes most commonly needed to build handlers, so handler bodies can import fromjsonapi_axumalone. - Resource
- Re-exports of the
jsonapi_coretypes most commonly needed to build handlers, so handler bodies can import fromjsonapi_axumalone. - Sort
Field - Re-exports of the
jsonapi_coretypes most commonly needed to build handlers, so handler bodies can import fromjsonapi_axumalone. - Type
Registry - Re-exports of the
jsonapi_coretypes most commonly needed to build handlers, so handler bodies can import fromjsonapi_axumalone.
Enums§
- Client
IdPolicy - Re-export the client-id policy so handlers can configure
JsonApi::check_client_idfrom one place. Policy for a client-suppliedidon a create (POST). - Document
- Re-exports of the
jsonapi_coretypes most commonly needed to build handlers, so handler bodies can import fromjsonapi_axumalone. - Field
- Re-exports of the
jsonapi_coretypes most commonly needed to build handlers, so handler bodies can import fromjsonapi_axumalone.
Constants§
- CURSOR_
PAGINATION_ PROFILE - Re-exports of the
jsonapi_coretypes most commonly needed to build handlers, so handler bodies can import fromjsonapi_axumalone.
Traits§
- ApiError
Ext - Re-export the fluent
ApiErrorbuilder surface so handlers can construct JSON:API errors without importingjsonapi_httpdirectly. Chainable,#[must_use]setters forApiError, letting an error be built fluently fromwith_status. - Include
Resolver - Re-export the compound-document
includeresolver so a handler can assemble a dedupedincludedarray from the requested include paths and a consumer-supplied batch loader. Batch loader for compound-document resolution. See the module docs.
Functions§
- resolve_
includes - Re-export the compound-document
includeresolver so a handler can assemble a dedupedincludedarray from the requested include paths and a consumer-supplied batch loader. Assemble the dedupedincludedarray for a compound document. - with_
status - Re-export the fluent
ApiErrorbuilder surface so handlers can construct JSON:API errors without importingjsonapi_httpdirectly. Start building anApiErrorfor the given HTTPstatus.