Skip to main content

Crate jsonapi_axum

Crate jsonapi_axum 

Source
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

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 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 extractor Rejection and 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 — an IntoResponse wrapper that serializes a Document as a JSON:API response via jsonapi_http.

Structs§

AcceptLayer
Rejects requests with no acceptable Accept media type with a 406 JSON:API error document (via crate::request::negotiate).
ApiError
Re-exports of the jsonapi_core types most commonly needed to build handlers, so handler bodies can import from jsonapi_axum alone.
ApiErrors
Re-export the fluent ApiError builder surface so handlers can construct JSON:API errors without importing jsonapi_http directly. A small accumulator for building a JSON:API errors list — collect one ApiError per problem (e.g. per invalid attribute), then turn the batch into a single errors document.
ContentTypeLayer
Rejects requests whose Content-Type is not application/vnd.api+json with a 415 JSON:API error document (via crate::request::check_content_type).
CursorLinks
Re-exports of the jsonapi_core types most commonly needed to build handlers, so handler bodies can import from jsonapi_axum alone.
CursorPage
Re-exports of the jsonapi_core types most commonly needed to build handlers, so handler bodies can import from jsonapi_axum alone.
DocumentBuilder
Re-exports of the jsonapi_core types most commonly needed to build handlers, so handler bodies can import from jsonapi_axum alone.
JsonApiLayer
Combined guard applying both ContentTypeLayer and AcceptLayer in one pass: content type is checked first, then Accept is negotiated.
JsonApiMediaType
Re-exports of the jsonapi_core types most commonly needed to build handlers, so handler bodies can import from jsonapi_axum alone.
OffsetPage
Re-exports of the jsonapi_core types most commonly needed to build handlers, so handler bodies can import from jsonapi_axum alone.
PageNumberPage
Re-exports of the jsonapi_core types most commonly needed to build handlers, so handler bodies can import from jsonapi_axum alone.
PageWindow
Re-exports of the jsonapi_core types most commonly needed to build handlers, so handler bodies can import from jsonapi_axum alone.
Query
Re-exports of the jsonapi_core types most commonly needed to build handlers, so handler bodies can import from jsonapi_axum alone.
Relationship
Re-exports of the jsonapi_core types most commonly needed to build handlers, so handler bodies can import from jsonapi_axum alone.
Resource
Re-exports of the jsonapi_core types most commonly needed to build handlers, so handler bodies can import from jsonapi_axum alone.
SortField
Re-exports of the jsonapi_core types most commonly needed to build handlers, so handler bodies can import from jsonapi_axum alone.
TypeRegistry
Re-exports of the jsonapi_core types most commonly needed to build handlers, so handler bodies can import from jsonapi_axum alone.

Enums§

ClientIdPolicy
Re-export the client-id policy so handlers can configure JsonApi::check_client_id from one place. Policy for a client-supplied id on a create (POST).
Document
Re-exports of the jsonapi_core types most commonly needed to build handlers, so handler bodies can import from jsonapi_axum alone.
Field
Re-exports of the jsonapi_core types most commonly needed to build handlers, so handler bodies can import from jsonapi_axum alone.

Constants§

CURSOR_PAGINATION_PROFILE
Re-exports of the jsonapi_core types most commonly needed to build handlers, so handler bodies can import from jsonapi_axum alone.

Traits§

ApiErrorExt
Re-export the fluent ApiError builder surface so handlers can construct JSON:API errors without importing jsonapi_http directly. Chainable, #[must_use] setters for ApiError, letting an error be built fluently from with_status.
IncludeResolver
Re-export the compound-document include resolver so a handler can assemble a deduped included array 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 include resolver so a handler can assemble a deduped included array from the requested include paths and a consumer-supplied batch loader. Assemble the deduped included array for a compound document.
with_status
Re-export the fluent ApiError builder surface so handlers can construct JSON:API errors without importing jsonapi_http directly. Start building an ApiError for the given HTTP status.