pub struct Schema {Show 65 fields
pub schema: Option<String>,
pub id: Option<String>,
pub ref_: Option<String>,
pub anchor: Option<String>,
pub dynamic_ref: Option<String>,
pub dynamic_anchor: Option<String>,
pub comment: Option<String>,
pub defs: Option<IndexMap<String, SchemaValue>>,
pub title: Option<String>,
pub description: Option<String>,
pub markdown_description: Option<String>,
pub default: Option<Value>,
pub deprecated: Option<bool>,
pub read_only: Option<bool>,
pub write_only: Option<bool>,
pub examples: Option<Vec<Value>>,
pub type_: Option<TypeValue>,
pub enum_: Option<Vec<Value>>,
pub const_: Option<Value>,
pub properties: Option<IndexMap<String, SchemaValue>>,
pub pattern_properties: Option<IndexMap<String, SchemaValue>>,
pub additional_properties: Option<Box<SchemaValue>>,
pub required: Option<Vec<String>>,
pub property_names: Option<Box<SchemaValue>>,
pub min_properties: Option<u64>,
pub max_properties: Option<u64>,
pub unevaluated_properties: Option<Box<SchemaValue>>,
pub items: Option<Box<SchemaValue>>,
pub prefix_items: Option<Vec<SchemaValue>>,
pub contains: Option<Box<SchemaValue>>,
pub min_contains: Option<u64>,
pub max_contains: Option<u64>,
pub min_items: Option<u64>,
pub max_items: Option<u64>,
pub unique_items: Option<bool>,
pub unevaluated_items: Option<Box<SchemaValue>>,
pub minimum: Option<Value>,
pub maximum: Option<Value>,
pub exclusive_minimum: Option<Value>,
pub exclusive_maximum: Option<Value>,
pub multiple_of: Option<Value>,
pub min_length: Option<u64>,
pub max_length: Option<u64>,
pub pattern: Option<String>,
pub format: Option<String>,
pub all_of: Option<Vec<SchemaValue>>,
pub any_of: Option<Vec<SchemaValue>>,
pub one_of: Option<Vec<SchemaValue>>,
pub not: Option<Box<SchemaValue>>,
pub if_: Option<Box<SchemaValue>>,
pub then_: Option<Box<SchemaValue>>,
pub else_: Option<Box<SchemaValue>>,
pub dependent_required: Option<IndexMap<String, Vec<String>>>,
pub dependent_schemas: Option<IndexMap<String, SchemaValue>>,
pub content_media_type: Option<String>,
pub content_encoding: Option<String>,
pub content_schema: Option<Box<SchemaValue>>,
pub x_taplo: Option<TaploSchemaExt>,
pub x_taplo_info: Option<Value>,
pub x_lintel: Option<LintelExt>,
pub x_tombi_toml_version: Option<String>,
pub x_tombi_table_keys_order: Option<Value>,
pub x_tombi_additional_key_label: Option<String>,
pub x_tombi_array_values_order: Option<Value>,
pub extra: IndexMap<String, Value>,
}Expand description
A JSON Schema object (draft 2020-12).
Fields§
§schema: Option<String>§id: Option<String>§ref_: Option<String>§anchor: Option<String>§dynamic_ref: Option<String>§dynamic_anchor: Option<String>§comment: Option<String>§defs: Option<IndexMap<String, SchemaValue>>§title: Option<String>§description: Option<String>§markdown_description: Option<String>§default: Option<Value>§deprecated: Option<bool>§read_only: Option<bool>§write_only: Option<bool>§examples: Option<Vec<Value>>§type_: Option<TypeValue>§enum_: Option<Vec<Value>>§const_: Option<Value>§properties: Option<IndexMap<String, SchemaValue>>§pattern_properties: Option<IndexMap<String, SchemaValue>>§additional_properties: Option<Box<SchemaValue>>§required: Option<Vec<String>>§property_names: Option<Box<SchemaValue>>§min_properties: Option<u64>§max_properties: Option<u64>§unevaluated_properties: Option<Box<SchemaValue>>§items: Option<Box<SchemaValue>>§prefix_items: Option<Vec<SchemaValue>>§contains: Option<Box<SchemaValue>>§min_contains: Option<u64>§max_contains: Option<u64>§min_items: Option<u64>§max_items: Option<u64>§unique_items: Option<bool>§unevaluated_items: Option<Box<SchemaValue>>§minimum: Option<Value>§maximum: Option<Value>§exclusive_minimum: Option<Value>§exclusive_maximum: Option<Value>§multiple_of: Option<Value>§min_length: Option<u64>§max_length: Option<u64>§pattern: Option<String>§format: Option<String>§all_of: Option<Vec<SchemaValue>>§any_of: Option<Vec<SchemaValue>>§one_of: Option<Vec<SchemaValue>>§not: Option<Box<SchemaValue>>§if_: Option<Box<SchemaValue>>§then_: Option<Box<SchemaValue>>§else_: Option<Box<SchemaValue>>§dependent_required: Option<IndexMap<String, Vec<String>>>§dependent_schemas: Option<IndexMap<String, SchemaValue>>§content_media_type: Option<String>§content_encoding: Option<String>§content_schema: Option<Box<SchemaValue>>§x_taplo: Option<TaploSchemaExt>§x_taplo_info: Option<Value>§x_lintel: Option<LintelExt>§x_tombi_toml_version: Option<String>§x_tombi_table_keys_order: Option<Value>§x_tombi_additional_key_label: Option<String>§x_tombi_array_values_order: Option<Value>§extra: IndexMap<String, Value>Implementations§
Source§impl Schema
impl Schema
Sourcepub fn from_value(value: Value) -> Result<Self, Error>
pub fn from_value(value: Value) -> Result<Self, Error>
Parse from a serde_json::Value without migration.
§Errors
Returns an error if the value cannot be deserialized into a Schema.
Sourcepub fn description(&self) -> Option<&str>
pub fn description(&self) -> Option<&str>
Get the best description text, preferring markdownDescription.
Sourcepub fn required_set(&self) -> &[String]
pub fn required_set(&self) -> &[String]
Get the required fields, or an empty slice.
Sourcepub fn is_deprecated(&self) -> bool
pub fn is_deprecated(&self) -> bool
Whether this schema is deprecated.
Sourcepub fn get_keyword(&self, key: &str) -> Option<&SchemaValue>
pub fn get_keyword(&self, key: &str) -> Option<&SchemaValue>
Look up a schema-keyword field by its JSON key name.
Returns a reference to the SchemaValue stored under that keyword,
or None if the field is absent.
Sourcepub fn get_map_entry(&self, keyword: &str, key: &str) -> Option<&SchemaValue>
pub fn get_map_entry(&self, keyword: &str, key: &str) -> Option<&SchemaValue>
Look up a named child within a keyword that holds a map of schemas.
For example, get_map_entry("properties", "name") returns the schema
for the name property.
Sourcepub fn get_array_entry(
&self,
keyword: &str,
index: usize,
) -> Option<&SchemaValue>
pub fn get_array_entry( &self, keyword: &str, index: usize, ) -> Option<&SchemaValue>
Look up an indexed child within a keyword that holds an array of schemas.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Schema
impl<'de> Deserialize<'de> for Schema
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Schema
impl RefUnwindSafe for Schema
impl Send for Schema
impl Sync for Schema
impl Unpin for Schema
impl UnsafeUnpin for Schema
impl UnwindSafe 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