pub struct Schema {
pub name: String,
pub source: String,
pub json: Value,
/* private fields */
}Expand description
One JSON Schema, compiled, with where it came from.
Fields§
§name: StringThe schema identity, <vendor>.<name>/v<n>, which its path derives.
source: StringDirectory the file was read from, repository-relative when inside the repository.
json: ValueThe schema as parsed: the whole document for a Markdown kind, the metadata itself for a YAML one.
Implementations§
Source§impl Schema
impl Schema
Sourcepub fn validate(&self, instance: &Value) -> Vec<Violation>
pub fn validate(&self, instance: &Value) -> Vec<Violation>
Every violation of the front matter instance, in document order; empty when it
conforms. For a Markdown kind this is the Header half of the contract; for a YAML
kind the metadata is the whole document and this is all of it.
Sourcepub fn validate_document(&self, instance: &Value) -> Vec<Violation>
pub fn validate_document(&self, instance: &Value) -> Vec<Violation>
Every violation of a whole document — {"header": ..., "body": ...} — in document
order. For a kind whose schema describes no body this is Self::validate.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Schema
impl !UnwindSafe for Schema
impl Freeze for Schema
impl Send for Schema
impl Sync for Schema
impl Unpin for Schema
impl UnsafeUnpin for Schema
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