pub struct OpenApiRouteRegistry { /* private fields */ }
Expand description
OpenAPI route registry that manages generated routes
Implementations§
Source§impl OpenApiRouteRegistry
impl OpenApiRouteRegistry
Sourcepub fn new(spec: OpenApiSpec) -> Self
pub fn new(spec: OpenApiSpec) -> Self
Create a new registry from an OpenAPI spec
pub fn new_with_env(spec: OpenApiSpec) -> Self
Sourcepub fn new_with_options(spec: OpenApiSpec, options: ValidationOptions) -> Self
pub fn new_with_options(spec: OpenApiSpec, options: ValidationOptions) -> Self
Construct with explicit options
pub fn clone_for_validation(&self) -> Self
Sourcepub fn routes(&self) -> &[OpenApiRoute]
pub fn routes(&self) -> &[OpenApiRoute]
Get all routes
Sourcepub fn spec(&self) -> &OpenApiSpec
pub fn spec(&self) -> &OpenApiSpec
Get the OpenAPI specification
Sourcepub fn build_router(self) -> Router
pub fn build_router(self) -> Router
Build an Axum router from the OpenAPI spec (simplified)
Sourcepub fn build_router_with_latency(
self,
latency_injector: LatencyInjector,
) -> Router
pub fn build_router_with_latency( self, latency_injector: LatencyInjector, ) -> Router
Build an Axum router from the OpenAPI spec with latency injection support
Sourcepub fn build_router_with_injectors(
self,
latency_injector: LatencyInjector,
failure_injector: Option<FailureInjector>,
) -> Router
pub fn build_router_with_injectors( self, latency_injector: LatencyInjector, failure_injector: Option<FailureInjector>, ) -> Router
Build an Axum router from the OpenAPI spec with both latency and failure injection support
Sourcepub fn build_router_with_injectors_and_overrides(
self,
latency_injector: LatencyInjector,
failure_injector: Option<FailureInjector>,
overrides: Option<Overrides>,
overrides_enabled: bool,
) -> Router
pub fn build_router_with_injectors_and_overrides( self, latency_injector: LatencyInjector, failure_injector: Option<FailureInjector>, overrides: Option<Overrides>, overrides_enabled: bool, ) -> Router
Build an Axum router from the OpenAPI spec with latency, failure injection, and overrides support
Sourcepub fn get_route(&self, path: &str, method: &str) -> Option<&OpenApiRoute>
pub fn get_route(&self, path: &str, method: &str) -> Option<&OpenApiRoute>
Get route by path and method
Sourcepub fn get_routes_for_path(&self, path: &str) -> Vec<&OpenApiRoute>
pub fn get_routes_for_path(&self, path: &str) -> Vec<&OpenApiRoute>
Get all routes for a specific path
Sourcepub fn validate_request(
&self,
path: &str,
method: &str,
body: Option<&Value>,
) -> Result<()>
pub fn validate_request( &self, path: &str, method: &str, body: Option<&Value>, ) -> Result<()>
Validate request against OpenAPI spec (legacy body-only)
Sourcepub fn validate_request_with(
&self,
path: &str,
method: &str,
path_params: &Map<String, Value>,
query_params: &Map<String, Value>,
body: Option<&Value>,
) -> Result<()>
pub fn validate_request_with( &self, path: &str, method: &str, path_params: &Map<String, Value>, query_params: &Map<String, Value>, body: Option<&Value>, ) -> Result<()>
Validate request against OpenAPI spec with path/query params
Sourcepub fn validate_request_with_all(
&self,
path: &str,
method: &str,
path_params: &Map<String, Value>,
query_params: &Map<String, Value>,
header_params: &Map<String, Value>,
cookie_params: &Map<String, Value>,
body: Option<&Value>,
) -> Result<()>
pub fn validate_request_with_all( &self, path: &str, method: &str, path_params: &Map<String, Value>, query_params: &Map<String, Value>, header_params: &Map<String, Value>, cookie_params: &Map<String, Value>, body: Option<&Value>, ) -> Result<()>
Validate request against OpenAPI spec with path/query/header/cookie params
Sourcepub fn get_operation(
&self,
path: &str,
method: &str,
) -> Option<OpenApiOperation>
pub fn get_operation( &self, path: &str, method: &str, ) -> Option<OpenApiOperation>
Get operation details for a route
Sourcepub fn extract_path_parameters(
&self,
path: &str,
method: &str,
) -> HashMap<String, String>
pub fn extract_path_parameters( &self, path: &str, method: &str, ) -> HashMap<String, String>
Extract path parameters from a request path by matching against known routes
Sourcepub fn convert_path_to_axum(openapi_path: &str) -> String
pub fn convert_path_to_axum(openapi_path: &str) -> String
Convert OpenAPI path to Axum-compatible path This is a utility function for converting path parameters from {param} to :param format
Sourcepub fn build_router_with_ai(
&self,
ai_generator: Option<Arc<dyn AiGenerator + Send + Sync>>,
) -> Router
pub fn build_router_with_ai( &self, ai_generator: Option<Arc<dyn AiGenerator + Send + Sync>>, ) -> Router
Build router with AI generator support
Trait Implementations§
Source§impl Clone for OpenApiRouteRegistry
impl Clone for OpenApiRouteRegistry
Source§fn clone(&self) -> OpenApiRouteRegistry
fn clone(&self) -> OpenApiRouteRegistry
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more