Struct anicca::openapi::Schema[][src]

pub struct Schema {
Show fields pub description: Option<String>, pub schema_type: Option<String>, pub format: Option<String>, pub enum_values: Option<Vec<Option<String>>>, pub required: Option<Vec<String>>, pub items: Option<Box<Schema>>, pub properties: Option<BTreeMap<String, Schema>>, pub read_only: Option<bool>, pub nullable: Option<bool>, pub additional_properties: Option<AdditionalProperties>, pub example: Option<Value>, pub title: Option<String>, pub default: Option<Value>, pub minimum: Option<Value>, pub all_of: Option<Vec<ReferenceOr<Schema>>>, pub one_of: Option<Vec<ReferenceOr<Schema>>>, pub any_of: Option<Vec<ReferenceOr<Schema>>>, pub not: Option<Vec<ReferenceOr<Schema>>>, pub max_length: Option<u32>, pub min_length: Option<u32>, pub extensions: BTreeMap<String, Value>,
}
Expand description

The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is an extended subset of the JSON Schema Specification Wright Draft 00. For more information about the properties, see JSON Schema Core and JSON Schema Validation. Unless stated otherwise, the property definitions follow the JSON Schema.

See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#schemaObject.

Fields

description: Option<String>schema_type: Option<String>format: Option<String>enum_values: Option<Vec<Option<String>>>required: Option<Vec<String>>items: Option<Box<Schema>>properties: Option<BTreeMap<String, Schema>>read_only: Option<bool>nullable: Option<bool>additional_properties: Option<AdditionalProperties>

Value can be boolean or object. Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.

See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#properties.

example: Option<Value>

A free-form property to include an example of an instance for this schema. To represent examples that cannot be naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary. NOTE: According to [spec], Primitive data types in the OAS are based on the types supported by the JSON Schema Specification Wright Draft 00. This suggest using serde_json::Value. [spec][https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#data-types]

title: Option<String>default: Option<Value>

The default value represents what would be assumed by the consumer of the input as the value of the schema if one is not provided. Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object defined at the same level. For example, if type is string, then default can be "foo" but cannot be 1.

minimum: Option<Value>all_of: Option<Vec<ReferenceOr<Schema>>>

Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. allOf

one_of: Option<Vec<ReferenceOr<Schema>>>

Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. oneOf

any_of: Option<Vec<ReferenceOr<Schema>>>

Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. anyOf

not: Option<Vec<ReferenceOr<Schema>>>

Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. not

max_length: Option<u32>min_length: Option<u32>extensions: BTreeMap<String, Value>

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

Deserialize this value from the given Serde deserializer. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.