pub struct MetaSchemaOptions { /* private fields */ }Expand description
Options for meta-schema validation.
Implementations§
Source§impl MetaSchemaOptions
impl MetaSchemaOptions
Sourcepub fn with_registry(self, registry: Registry) -> Self
pub fn with_registry(self, registry: Registry) -> Self
Use a registry for resolving custom meta-schemas.
§Examples
use serde_json::json;
use jsonschema::{Registry, Resource};
let custom_meta = Resource::from_contents(json!({
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object"
}));
let registry = Registry::try_new(
"http://example.com/meta",
custom_meta
).unwrap();
let options = jsonschema::meta::options()
.with_registry(registry);Sourcepub fn is_valid(&self, schema: &Value) -> bool
pub fn is_valid(&self, schema: &Value) -> bool
Check if a schema is valid according to its meta-schema.
§Panics
Panics if the meta-schema cannot be resolved.
Sourcepub fn validate<'a>(&self, schema: &'a Value) -> Result<(), ValidationError<'a>>
pub fn validate<'a>(&self, schema: &'a Value) -> Result<(), ValidationError<'a>>
Validate a schema according to its meta-schema.
§Errors
Returns ValidationError if the schema is invalid or if the meta-schema cannot be resolved.
Trait Implementations§
Source§impl Clone for MetaSchemaOptions
impl Clone for MetaSchemaOptions
Source§fn clone(&self) -> MetaSchemaOptions
fn clone(&self) -> MetaSchemaOptions
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 moreSource§impl Default for MetaSchemaOptions
impl Default for MetaSchemaOptions
Source§fn default() -> MetaSchemaOptions
fn default() -> MetaSchemaOptions
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for MetaSchemaOptions
impl !RefUnwindSafe for MetaSchemaOptions
impl Send for MetaSchemaOptions
impl Sync for MetaSchemaOptions
impl Unpin for MetaSchemaOptions
impl UnsafeUnpin for MetaSchemaOptions
impl UnwindSafe for MetaSchemaOptions
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