pub struct AuthRoute {
pub server_only: bool,
pub path: String,
pub method: HttpMethod,
pub operation_id: String,
pub openapi: Option<OpenApiRouteMetadata>,
pub endpoint_key: Option<String>,
pub allowed_media_types: Vec<String>,
pub query_validator: Option<QueryValidator>,
pub body_validator: Option<BodyValidator>,
pub require_headers: bool,
}Expand description
Route definition for plugins
Fields§
§server_only: boolNative-only endpoints cannot match HTTP routing.
path: String§method: HttpMethod§operation_id: StringIdentifier used as the OpenAPI operationId for this route.
openapi: Option<OpenApiRouteMetadata>Explicit OpenAPI documentation. This does not validate endpoint input.
endpoint_key: Option<String>Upstream API key used when excluding plugin endpoints that replace core endpoints.
allowed_media_types: Vec<String>HTTP media types accepted before endpoint middleware. Empty uses the JSON default.
query_validator: Option<QueryValidator>Query validation runs after before hooks and before endpoint middleware.
body_validator: Option<BodyValidator>§require_headers: boolHeader presence is validated after body and query, before endpoint middleware.
Implementations§
Source§impl AuthRoute
impl AuthRoute
Sourcepub fn server_only(method: HttpMethod, operation_id: impl Into<String>) -> Self
pub fn server_only(method: HttpMethod, operation_id: impl Into<String>) -> Self
Define an endpoint that is available only through trusted native facades.
Sourcepub fn matches(&self, method: &HttpMethod, path: &str) -> bool
pub fn matches(&self, method: &HttpMethod, path: &str) -> bool
Match the method and slash-separated path, including named {parameter} segments.
pub fn openapi(self, metadata: OpenApiRouteMetadata) -> Self
pub fn endpoint_key(self, key: impl Into<String>) -> Self
Sourcepub fn body_validator(
self,
validator: impl Fn(&AuthRequest) -> AuthResult<ValidatedBody> + Send + Sync + 'static,
) -> Self
pub fn body_validator( self, validator: impl Fn(&AuthRequest) -> AuthResult<ValidatedBody> + Send + Sync + 'static, ) -> Self
Install a body validator. Body validation precedes query validation.
Sourcepub fn body_validator_async<F, Fut>(self, validator: F) -> Selfwhere
F: Fn(AuthRequest) -> Fut + Send + Sync + 'static,
Fut: Future<Output = AuthResult<ValidatedBody>> + Send + 'static,
pub fn body_validator_async<F, Fut>(self, validator: F) -> Selfwhere
F: Fn(AuthRequest) -> Fut + Send + Sync + 'static,
Fut: Future<Output = AuthResult<ValidatedBody>> + Send + 'static,
Install an asynchronous body validator at the same phase as synchronous validation.
Sourcepub fn query_validator(self, validator: QueryValidator) -> Self
pub fn query_validator(self, validator: QueryValidator) -> Self
Install a query validator for the endpoint handler and its middleware.