#[non_exhaustive]pub enum Draft {
Draft4,
Draft6,
Draft7,
Draft201909,
Draft202012,
}Expand description
JSON Schema specification versions.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Draft4
JSON Schema Draft 4
Draft6
JSON Schema Draft 6
Draft7
JSON Schema Draft 7
Draft201909
JSON Schema Draft 2019-09
Draft202012
JSON Schema Draft 2020-12
Implementations§
Source§impl Draft
impl Draft
Sourcepub fn create_resource(self, contents: Value) -> Resource
pub fn create_resource(self, contents: Value) -> Resource
Wraps contents in a Resource tagged with this draft version.
Sourcepub fn create_resource_ref(self, contents: &Value) -> ResourceRef<'_>
pub fn create_resource_ref(self, contents: &Value) -> ResourceRef<'_>
Wraps a reference to contents in a ResourceRef tagged with this draft version.
Sourcepub fn from_schema_uri(uri: &str) -> Draft
pub fn from_schema_uri(uri: &str) -> Draft
Detect a draft from a $schema URI string.
Accepts the URI with or without a trailing #. Returns Draft::Unknown
for custom/unknown meta-schema URIs.
Sourcepub fn detect(self, contents: &Value) -> Draft
pub fn detect(self, contents: &Value) -> Draft
Detect what specification could be applied to the given contents.
Inspects the $schema field and returns the matching draft. If no $schema
field is present, returns self unchanged — the caller’s current draft is preserved.
Returns Draft::Unknown for custom/unknown $schema values.
Validation of custom meta-schemas happens during registry building.
Sourcepub const fn id_keyword(self) -> &'static str
pub const fn id_keyword(self) -> &'static str
Returns the schema identifier keyword used by this draft.
pub fn subresources_of(self, contents: &Value) -> impl Iterator<Item = &Value>
Sourcepub fn is_known_keyword(&self, keyword: &str) -> bool
pub fn is_known_keyword(&self, keyword: &str) -> bool
Identifies known JSON schema keywords per draft.
Trait Implementations§
impl Copy for Draft
impl Eq for Draft
Source§impl Ord for Draft
impl Ord for Draft
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Draft
impl PartialOrd for Draft
impl StructuralPartialEq for Draft
Auto Trait Implementations§
impl Freeze for Draft
impl RefUnwindSafe for Draft
impl Send for Draft
impl Sync for Draft
impl Unpin for Draft
impl UnsafeUnpin for Draft
impl UnwindSafe for Draft
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.