pub struct JsonSchema2020 {Show 47 fields
pub schema: Option<String>,
pub id: Option<String>,
pub reference: Option<String>,
pub dynamic_ref: Option<String>,
pub schema_type: Option<TypeArray>,
pub title: Option<String>,
pub description: Option<String>,
pub default: Option<Value>,
pub const_value: Option<Value>,
pub enum_values: Option<Vec<Value>>,
pub min_length: Option<u64>,
pub max_length: Option<u64>,
pub pattern: Option<String>,
pub format: Option<String>,
pub minimum: Option<f64>,
pub maximum: Option<f64>,
pub exclusive_minimum: Option<f64>,
pub exclusive_maximum: Option<f64>,
pub multiple_of: Option<f64>,
pub items: Option<Box<JsonSchema2020>>,
pub prefix_items: Option<Vec<JsonSchema2020>>,
pub contains: Option<Box<JsonSchema2020>>,
pub min_items: Option<u64>,
pub max_items: Option<u64>,
pub unique_items: Option<bool>,
pub properties: Option<HashMap<String, JsonSchema2020>>,
pub pattern_properties: Option<HashMap<String, JsonSchema2020>>,
pub additional_properties: Option<Box<AdditionalProperties>>,
pub required: Option<Vec<String>>,
pub property_names: Option<Box<JsonSchema2020>>,
pub min_properties: Option<u64>,
pub max_properties: Option<u64>,
pub all_of: Option<Vec<JsonSchema2020>>,
pub any_of: Option<Vec<JsonSchema2020>>,
pub one_of: Option<Vec<JsonSchema2020>>,
pub not: Option<Box<JsonSchema2020>>,
pub if_schema: Option<Box<JsonSchema2020>>,
pub then_schema: Option<Box<JsonSchema2020>>,
pub else_schema: Option<Box<JsonSchema2020>>,
pub deprecated: Option<bool>,
pub read_only: Option<bool>,
pub write_only: Option<bool>,
pub example: Option<Value>,
pub examples: Option<Vec<Value>>,
pub discriminator: Option<Discriminator>,
pub external_docs: Option<ExternalDocumentation>,
pub xml: Option<Xml>,
}Expand description
JSON Schema 2020-12 schema definition
Fields§
§schema: Option<String>Schema dialect identifier
id: Option<String>Schema identifier
reference: Option<String>Reference to another schema
dynamic_ref: Option<String>Dynamic reference
schema_type: Option<TypeArray>Type of the schema
title: Option<String>Title of the schema
description: Option<String>Description of the schema
default: Option<Value>Default value
const_value: Option<Value>Constant value
enum_values: Option<Vec<Value>>Enum values
min_length: Option<u64>Minimum length for strings
max_length: Option<u64>Maximum length for strings
pattern: Option<String>Pattern for strings
format: Option<String>Format hint
minimum: Option<f64>Minimum value (inclusive)
maximum: Option<f64>Maximum value (inclusive)
exclusive_minimum: Option<f64>Exclusive minimum (JSON Schema 2020-12 uses number, not boolean)
exclusive_maximum: Option<f64>Exclusive maximum (JSON Schema 2020-12 uses number, not boolean)
multiple_of: Option<f64>Multiple of constraint
items: Option<Box<JsonSchema2020>>Items schema
prefix_items: Option<Vec<JsonSchema2020>>Prefix items (replaces “items” array in draft-07)
contains: Option<Box<JsonSchema2020>>Contains constraint
min_items: Option<u64>Minimum items
max_items: Option<u64>Maximum items
unique_items: Option<bool>Unique items
properties: Option<HashMap<String, JsonSchema2020>>Object properties
pattern_properties: Option<HashMap<String, JsonSchema2020>>Pattern properties
additional_properties: Option<Box<AdditionalProperties>>Additional properties
required: Option<Vec<String>>Required properties
property_names: Option<Box<JsonSchema2020>>Property names schema
min_properties: Option<u64>Minimum properties
max_properties: Option<u64>Maximum properties
all_of: Option<Vec<JsonSchema2020>>All of (must match all schemas)
any_of: Option<Vec<JsonSchema2020>>Any of (must match at least one schema)
one_of: Option<Vec<JsonSchema2020>>One of (must match exactly one schema)
not: Option<Box<JsonSchema2020>>Not (must not match schema)
if_schema: Option<Box<JsonSchema2020>>If condition
then_schema: Option<Box<JsonSchema2020>>Then schema
else_schema: Option<Box<JsonSchema2020>>Else schema
deprecated: Option<bool>Whether this property is deprecated
read_only: Option<bool>Whether this property is read-only
write_only: Option<bool>Whether this property is write-only
example: Option<Value>Example value
examples: Option<Vec<Value>>Examples (JSON Schema 2020-12)
discriminator: Option<Discriminator>OpenAPI discriminator
external_docs: Option<ExternalDocumentation>External documentation
xml: Option<Xml>XML metadata
Implementations§
Source§impl JsonSchema2020
impl JsonSchema2020
Sourcepub fn array(items: JsonSchema2020) -> Self
pub fn array(items: JsonSchema2020) -> Self
Create an array schema
Sourcepub fn with_title(self, title: impl Into<String>) -> Self
pub fn with_title(self, title: impl Into<String>) -> Self
Add a title
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Add a description
Sourcepub fn with_format(self, format: impl Into<String>) -> Self
pub fn with_format(self, format: impl Into<String>) -> Self
Add a format
Sourcepub fn with_property(
self,
name: impl Into<String>,
schema: JsonSchema2020,
) -> Self
pub fn with_property( self, name: impl Into<String>, schema: JsonSchema2020, ) -> Self
Add a property to an object schema
Sourcepub fn with_required(self, name: impl Into<String>) -> Self
pub fn with_required(self, name: impl Into<String>) -> Self
Add a required property
Sourcepub fn with_example(self, example: Value) -> Self
pub fn with_example(self, example: Value) -> Self
Add an example
Trait Implementations§
Source§impl Clone for JsonSchema2020
impl Clone for JsonSchema2020
Source§fn clone(&self) -> JsonSchema2020
fn clone(&self) -> JsonSchema2020
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more