Skip to main content

Crate soma_http_api

Crate soma_http_api 

Source
Expand description

Reusable HTTP API surface mechanics (plan section 3.11).

soma-http-server (a later slice, plan section 3.12) owns generic Axum server lifecycle — listener binding, graceful shutdown, middleware. This crate owns the layer above that: reusable API surface shapes — response envelopes, error/problem-details bodies, liveness/readiness probe DTOs, route inventory metadata, and pagination query DTOs.

This crate must stay product-agnostic: no Soma action names, no /v1/* route paths, no auth policy, no product service/runtime state. Product routes and their concrete data live in soma-api.

Modules§

json
Generic “parse a JSON body, or fall back to a default when the client sent none” helper — the shape every REST handler in this workspace that accepts an optional body already needs.
pagination
Generic pagination query and response DTOs.
probe
Reusable liveness/readiness probe DTOs and response helpers.
problem
A minimal, product-neutral structured-error response body.
response
Reusable JSON response envelope and error-body helpers.
route_inventory
Generic route inventory metadata and documentation helpers.