Skip to main content

Crate jsonapi_http

Crate jsonapi_http 

Source
Expand description

Framework-agnostic HTTP integration for jsonapi_core.

This crate turns the pieces jsonapi_core already provides (content-type validation, Accept negotiation, query parsing, document building) into plain functions and tower middleware over the http crate’s request/response types. It contains no web-framework dependency; adapters such as jsonapi_axum provide the thin FromRequest/IntoResponse bindings on top.

§Module map

  • error — map jsonapi_core::Error to an HTTP status and a JSON:API error document response.
  • id — resource-id consistency and client-id policy checks.
  • request — parse an incoming request (content type, accept, query, typed body) into typed values.
  • response — build a JSON:API http::Response from a document.
  • layertower layers that reject non-conforming requests early.

Re-exports§

pub use error::ApiErrorExt;
pub use error::ApiErrors;
pub use error::api_error_for_status;
pub use error::error_response;
pub use error::error_response_for;
pub use error::error_response_for_status;
pub use error::stamp_error_ids;
pub use error::stamp_error_ids_in_bytes;
pub use error::status_for;
pub use error::to_api_error;
pub use error::with_status;
pub use id::ClientIdPolicy;
pub use id::check_client_id;
pub use id::check_id_matches;
pub use id::id_conflict;
pub use include::IncludeResolver;
pub use include::resolve_includes;
pub use layer::AcceptLayer;
pub use layer::ContentTypeLayer;
pub use layer::GuardService;
pub use layer::JsonApiLayer;
pub use request::check_content_type;
pub use request::deserialize_body;
pub use request::negotiate;
pub use request::parse_query;
pub use response::content_type_value;
pub use response::document_response;
pub use response::json_api_response;
pub use response::json_api_response_filtered;
pub use response::try_document_response;
pub use response::try_json_api_response;
pub use response::try_json_api_response_filtered;

Modules§

error
Map jsonapi_core::Error to HTTP status codes and JSON:API error documents.
id
Resource-id consistency and client-generated-id policy (JSON:API write rules), as framework-agnostic checks producing typed ApiErrors.
include
Compound-document / include resolution.
layer
tower middleware that rejects non-conforming requests before they reach a handler, responding with a JSON:API error document.
request
Parse an incoming HTTP request into typed JSON:API values.
response
Build JSON:API http::Responses from documents.

Constants§

JSON_API_MEDIA_TYPE
The JSON:API media type: application/vnd.api+json.