pub struct OutputValidator { /* private fields */ }Expand description
Validator for structured output.
Validates JSON data against JSON schemas with full error reporting.
Implementations§
Source§impl OutputValidator
impl OutputValidator
Sourcepub fn new(schema: Value, strict: bool) -> Self
pub fn new(schema: Value, strict: bool) -> Self
Create a new validator with a schema.
§Arguments
schema- JSON schema as a serde_json::Valuestrict- Whether to use strict validation (disallow extra properties by default)
Sourcepub fn strict(schema: Value) -> Self
pub fn strict(schema: Value) -> Self
Create a new validator with a schema (strict mode enabled).
Sourcepub fn lenient(schema: Value) -> Self
pub fn lenient(schema: Value) -> Self
Create a new validator with a schema (strict mode disabled).
Sourcepub fn permissive() -> Self
pub fn permissive() -> Self
Create a validator without a schema (permissive mode).
Sourcepub fn validate(&self, data: impl IntoValidatorData) -> ValidationResult
pub fn validate(&self, data: impl IntoValidatorData) -> ValidationResult
Sourcepub fn validate_or_fail(
&self,
data: impl IntoValidatorData,
) -> Result<Value, Vec<ValidationError>>
pub fn validate_or_fail( &self, data: impl IntoValidatorData, ) -> Result<Value, Vec<ValidationError>>
Auto Trait Implementations§
impl Freeze for OutputValidator
impl RefUnwindSafe for OutputValidator
impl Send for OutputValidator
impl Sync for OutputValidator
impl Unpin for OutputValidator
impl UnsafeUnpin for OutputValidator
impl UnwindSafe for OutputValidator
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