pub struct ParameterValidator { /* private fields */ }Expand description
Parameter validator that uses JSON Schema
Implementations§
Source§impl ParameterValidator
impl ParameterValidator
Sourcepub fn new(schema: Value) -> Result<Self, String>
pub fn new(schema: Value) -> Result<Self, String>
Create a new parameter validator from a JSON Schema
The schema should describe all parameters with their types and constraints. Each property MUST have a “source” field indicating where the parameter comes from.
Sourcepub fn validate_and_extract(
&self,
query_params: &Value,
raw_query_params: &HashMap<String, Vec<String>>,
path_params: &HashMap<String, String>,
headers: &HashMap<String, String>,
cookies: &HashMap<String, String>,
) -> Result<Value, ValidationError>
pub fn validate_and_extract( &self, query_params: &Value, raw_query_params: &HashMap<String, Vec<String>>, path_params: &HashMap<String, String>, headers: &HashMap<String, String>, cookies: &HashMap<String, String>, ) -> Result<Value, ValidationError>
Validate and extract parameters from the request
This builds a JSON object from query/path/header/cookie params and validates it. It performs type coercion (e.g., “123” → 123) based on the schema.
Returns the validated JSON object that can be directly converted to Python kwargs.
Trait Implementations§
Source§impl Clone for ParameterValidator
impl Clone for ParameterValidator
Source§fn clone(&self) -> ParameterValidator
fn clone(&self) -> ParameterValidator
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ParameterValidator
impl RefUnwindSafe for ParameterValidator
impl Send for ParameterValidator
impl Sync for ParameterValidator
impl Unpin for ParameterValidator
impl UnwindSafe for ParameterValidator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more