pub enum SpecVersion {
Draft00,
Draft01,
Draft02,
Draft03,
Draft04,
Draft05,
Draft06,
Draft07,
Draft201909,
Draft202012,
}Expand description
JSON Schema specification version. One variant per vendored spec.
Variants§
Implementations§
Source§impl SpecVersion
impl SpecVersion
Sourcepub fn schema_uri(self) -> &'static str
pub fn schema_uri(self) -> &'static str
Returns the canonical meta-schema URI for this draft (e.g. for use in $schema).
URIs match the local specs (draft-00 through 2020-12). Drafts 00–02 used hyper-schema URIs; draft-03 onward use schema# or draft/YYYY-MM/schema.
Sourcepub fn from_schema_uri(s: &str) -> Option<SpecVersion>
pub fn from_schema_uri(s: &str) -> Option<SpecVersion>
Parses a $schema URI string and returns the corresponding SpecVersion, if recognized.
Matching is done by comparing the trimmed string to canonical URIs (with or without
trailing slash). The legacy draft-04 URI http://json-schema.org/schema# is
deprecated and returns [Some(SpecVersion::Draft04)] for compatibility.
Returns None for empty, unknown, or malformed URIs.
Sourcepub fn default_schema_settings(self) -> JsonSchemaSettings
pub fn default_schema_settings(self) -> JsonSchemaSettings
Returns JsonSchemaSettings tuned for this spec version.
Callers can use the builder to override individual options.
Default (latest) spec: Draft202012 is
the latest supported spec; its settings match
JsonSchemaSettings::default() when no options are set.
Trait Implementations§
Source§impl Clone for SpecVersion
impl Clone for SpecVersion
Source§fn clone(&self) -> SpecVersion
fn clone(&self) -> SpecVersion
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more