Skip to main content

Module operation_builder

Module operation_builder 

Source
Expand description

Type-safe API operation builder with compile-time guarantees

This gear implements a type-state builder pattern that ensures:

  • register() cannot be called unless a handler is set
  • register() cannot be called unless at least one response is declared
  • Descriptive methods remain available at any stage
  • No panics or unwraps in production hot paths
  • Request body support (json_request, json_request_schema) so POST/PUT calls are invokable in UI
  • Schema-aware responses (json_response_with_schema)
  • Typed Router state S usage pattern: pass a state type once via Router::with_state, then use plain function handlers (no per-route closures that capture/clones).
  • Optional method_router(...) for advanced use (layers/middleware on route level).

Re-exports§

pub use state::AuthNotSet;
pub use state::AuthSet;
pub use state::LicenseNotSet;
pub use state::LicenseSet;
pub use state::Missing;
pub use state::Present;
pub use crate::api::openapi_registry::OpenApiRegistry;
pub use crate::api::openapi_registry::ensure_schema;

Modules§

state
Type-state markers for compile-time enforcement

Structs§

LicenseReqSpec
License requirement specification for an operation
ODataPagination
OperationBuilder
Type-safe operation builder with compile-time guarantees.
OperationSpec
Simplified operation specification for the type-safe builder
ParamSpec
Parameter specification for API operations
RequestBodySpec
Request body specification for API operations
ResponseHeaderSpec
Header declared on one API response.
ResponseSpec
Response specification for API operations
ThrottlingSpec
Per-operation throttling specification.
VendorExtensions
XPagination

Enums§

ParamLocation
RequestBodySchema
Request body schema variants for different kinds of request bodies
ResponseHeaderType
JSON Schema scalar type of a response header.
ResponseSchema
Response body schema variants.

Constants§

CORE_GLOBAL_BASE_LICENSE_FEATURE
Canonical base license feature used by the example gears.

Traits§

AuthState
Sealed trait for auth state markers
HandlerSlot
LicenseFeature
LicenseState
OperationBuilderODataExt

Functions§

axum_to_openapi_path
Convert Axum 0.8+ style path parameters to OpenAPI-style placeholders.
normalize_to_axum_path
Convert OpenAPI-style path placeholders to Axum 0.8+ style path parameters.