pub struct ValidationResponse {
pub result: ValidationResult,
pub auto_approved: bool,
pub action: Option<UnifiedAction>,
pub validated_code_hash: Option<String>,
}Expand description
Response from validate_code_impl containing validation results plus
handler-specific metadata.
Wraps ValidationResult from the validation pipeline and adds fields
for handler-level concerns (auto-approval, unified action, code hash).
Fields§
§result: ValidationResultCore validation result from the pipeline.
auto_approved: boolWhether this was auto-approved based on risk level.
action: Option<UnifiedAction>Unified action (Read, Write, Delete, Admin).
validated_code_hash: Option<String>SHA-256 hash of the canonicalized code that was validated.
Implementations§
Source§impl ValidationResponse
impl ValidationResponse
Sourcepub fn success(
explanation: String,
risk_level: RiskLevel,
approval_token: String,
metadata: ValidationMetadata,
) -> Self
pub fn success( explanation: String, risk_level: RiskLevel, approval_token: String, metadata: ValidationMetadata, ) -> Self
Create a successful validation response.
Sourcepub fn failure(
violations: Vec<PolicyViolation>,
metadata: ValidationMetadata,
) -> Self
pub fn failure( violations: Vec<PolicyViolation>, metadata: ValidationMetadata, ) -> Self
Create a failed validation response.
Sourcepub fn from_result(result: ValidationResult) -> Self
pub fn from_result(result: ValidationResult) -> Self
Create from an existing ValidationResult.
Sourcepub fn with_code_hash(self, hash: String) -> Self
pub fn with_code_hash(self, hash: String) -> Self
Set the validated code hash (SHA-256 of canonicalized code).
Sourcepub fn with_action(self, action: UnifiedAction) -> Self
pub fn with_action(self, action: UnifiedAction) -> Self
Set the action for this response.
Sourcepub fn with_auto_approved(self, auto_approved: bool) -> Self
pub fn with_auto_approved(self, auto_approved: bool) -> Self
Set auto_approved flag.
Sourcepub fn with_warnings(self, warnings: Vec<String>) -> Self
pub fn with_warnings(self, warnings: Vec<String>) -> Self
Add warnings to the response.
Sourcepub fn to_json_response(&self) -> (Value, bool)
pub fn to_json_response(&self) -> (Value, bool)
Convert to JSON response format.
Returns a tuple of (json_value, is_error).
Trait Implementations§
Source§impl Clone for ValidationResponse
impl Clone for ValidationResponse
Source§fn clone(&self) -> ValidationResponse
fn clone(&self) -> ValidationResponse
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ValidationResponse
impl Debug for ValidationResponse
Source§impl<'de> Deserialize<'de> for ValidationResponse
impl<'de> Deserialize<'de> for ValidationResponse
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for ValidationResponse
impl RefUnwindSafe for ValidationResponse
impl Send for ValidationResponse
impl Sync for ValidationResponse
impl Unpin for ValidationResponse
impl UnsafeUnpin for ValidationResponse
impl UnwindSafe for ValidationResponse
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more