pub struct ValidationPipeline<T: TokenGenerator = HmacTokenGenerator, E: ExplanationGenerator = TemplateExplanationGenerator> { /* private fields */ }Expand description
The validation pipeline that orchestrates all validation stages.
Implementations§
Source§impl ValidationPipeline<HmacTokenGenerator, TemplateExplanationGenerator>
impl ValidationPipeline<HmacTokenGenerator, TemplateExplanationGenerator>
Sourcepub fn new(config: CodeModeConfig, token_secret: impl Into<Vec<u8>>) -> Self
pub fn new(config: CodeModeConfig, token_secret: impl Into<Vec<u8>>) -> Self
Create a new validation pipeline with default generators.
Warning: This constructor does not configure a policy evaluator. Only basic config checks will be performed.
Sourcepub fn with_policy_evaluator(
config: CodeModeConfig,
token_secret: impl Into<Vec<u8>>,
evaluator: Box<dyn PolicyEvaluator>,
) -> Self
pub fn with_policy_evaluator( config: CodeModeConfig, token_secret: impl Into<Vec<u8>>, evaluator: Box<dyn PolicyEvaluator>, ) -> Self
Create a new validation pipeline with a policy evaluator.
Source§impl<T: TokenGenerator, E: ExplanationGenerator> ValidationPipeline<T, E>
impl<T: TokenGenerator, E: ExplanationGenerator> ValidationPipeline<T, E>
Sourcepub fn with_generators(
config: CodeModeConfig,
token_generator: T,
explanation_generator: E,
) -> Self
pub fn with_generators( config: CodeModeConfig, token_generator: T, explanation_generator: E, ) -> Self
Create a pipeline with custom generators.
Sourcepub fn set_policy_evaluator(&mut self, evaluator: Box<dyn PolicyEvaluator>)
pub fn set_policy_evaluator(&mut self, evaluator: Box<dyn PolicyEvaluator>)
Set the policy evaluator for this pipeline.
Sourcepub fn has_policy_evaluator(&self) -> bool
pub fn has_policy_evaluator(&self) -> bool
Check if a policy evaluator is configured.
Sourcepub fn validate_graphql_query(
&self,
query: &str,
context: &ValidationContext,
) -> Result<ValidationResult, ValidationError>
pub fn validate_graphql_query( &self, query: &str, context: &ValidationContext, ) -> Result<ValidationResult, ValidationError>
Validate a GraphQL query using basic config checks only.
Sourcepub async fn validate_graphql_query_async(
&self,
query: &str,
context: &ValidationContext,
) -> Result<ValidationResult, ValidationError>
pub async fn validate_graphql_query_async( &self, query: &str, context: &ValidationContext, ) -> Result<ValidationResult, ValidationError>
Validate a GraphQL query using a policy evaluator (async).
Sourcepub fn should_auto_approve(&self, result: &ValidationResult) -> bool
pub fn should_auto_approve(&self, result: &ValidationResult) -> bool
Check if a validation result should be auto-approved.
Sourcepub fn config(&self) -> &CodeModeConfig
pub fn config(&self) -> &CodeModeConfig
Get the config.
Sourcepub fn token_generator(&self) -> &T
pub fn token_generator(&self) -> &T
Get the token generator.
Auto Trait Implementations§
impl<T, E> Freeze for ValidationPipeline<T, E>
impl<T = HmacTokenGenerator, E = TemplateExplanationGenerator> !RefUnwindSafe for ValidationPipeline<T, E>
impl<T, E> Send for ValidationPipeline<T, E>
impl<T, E> Sync for ValidationPipeline<T, E>
impl<T, E> Unpin for ValidationPipeline<T, E>
impl<T, E> UnsafeUnpin for ValidationPipeline<T, E>where
T: UnsafeUnpin,
E: UnsafeUnpin,
impl<T = HmacTokenGenerator, E = TemplateExplanationGenerator> !UnwindSafe for ValidationPipeline<T, E>
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