Skip to main content

Schema

Struct Schema 

Source
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

Source

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.

Source

pub fn description(&self) -> Option<&str>

Get the best description text, preferring markdownDescription.

Source

pub fn required_set(&self) -> &[String]

Get the required fields, or an empty slice.

Source

pub fn is_deprecated(&self) -> bool

Whether this schema is deprecated.

Source

pub fn type_str(&self) -> Option<String>

Produce a short human-readable type string.

Source

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.

Source

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.

Source

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 Clone for Schema

Source§

fn clone(&self) -> Schema

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Schema

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Schema

Source§

fn default() -> Schema

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Schema

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Schema

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,