#[non_exhaustive]pub struct Array {Show 15 fields
pub schema_type: SchemaType,
pub title: Option<String>,
pub items: ArrayItems,
pub prefix_items: Vec<RefOr<Schema>>,
pub description: Option<String>,
pub deprecated: Option<Deprecated>,
pub examples: Vec<Value>,
pub default_value: Option<Value>,
pub max_items: Option<usize>,
pub min_items: Option<usize>,
pub unique_items: bool,
pub xml: Option<Xml>,
pub content_encoding: Option<String>,
pub content_media_type: Option<String>,
pub extensions: PropMap<String, Value>,
}Expand description
Array represents Vec or slice type of items.
See Schema::Array for more details.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.schema_type: SchemaTypeType will always be SchemaType::Array
title: Option<String>Changes the Array title.
items: ArrayItemsSchema representing the array items type.
prefix_items: Vec<RefOr<Schema>>Prefix items of Array is used to define item validation of tuples according to
JSON schema item validation.
description: Option<String>Description of the Array. Markdown syntax is supported.
deprecated: Option<Deprecated>Marks the Array deprecated.
examples: Vec<Value>Examples shown in UI of the value for richer documentation.
default_value: Option<Value>Default value which is provided when user has not provided the input in Swagger UI.
max_items: Option<usize>Max length of the array.
min_items: Option<usize>Min length of the array.
unique_items: boolSetting this to true will validate successfully if all elements of this Array are
unique.
xml: Option<Xml>Xml format of the array.
content_encoding: Option<String>The content_encoding keyword specifies the encoding used to store the contents, as
specified in RFC 2054, part 6.1 and [RFC 4648](RFC 2054, part 6.1).
See more details at https://json-schema.org/understanding-json-schema/reference/non_json_data#contentencoding
content_media_type: Option<String>The content_media_type keyword specifies the MIME type of the contents of a string,
as described in RFC 2046.
See more details at https://json-schema.org/understanding-json-schema/reference/non_json_data#contentmediatype
extensions: PropMap<String, Value>Optional extensions x-something.
Implementations§
Source§impl Array
impl Array
Sourcepub fn prefix_items<I: IntoIterator<Item = S>, S: Into<RefOr<Schema>>>(
self,
items: I,
) -> Self
pub fn prefix_items<I: IntoIterator<Item = S>, S: Into<RefOr<Schema>>>( self, items: I, ) -> Self
Add prefix items of Array to define item validation of tuples according to
JSON schema item validation.
Sourcepub fn schema_type<T: Into<SchemaType>>(self, schema_type: T) -> Self
pub fn schema_type<T: Into<SchemaType>>(self, schema_type: T) -> Self
Change type of the array e.g. to change type to string
use value SchemaType::Type(Type::String).
§Examples
Make nullable string array.
let _ = Array::new()
.schema_type(SchemaType::from_iter([BasicType::Array, BasicType::Null]))
.items(Object::with_type(BasicType::String));Sourcepub fn description(self, description: impl Into<String>) -> Self
pub fn description(self, description: impl Into<String>) -> Self
Add or change description of the property. Markdown syntax is supported.
Sourcepub fn deprecated(self, deprecated: Deprecated) -> Self
pub fn deprecated(self, deprecated: Deprecated) -> Self
Add or change deprecated status for Array.
Sourcepub fn example<V: Into<Value>>(self, example: V) -> Self
pub fn example<V: Into<Value>>(self, example: V) -> Self
Add or change example shown in UI of the value for richer documentation.
Sourcepub fn examples<I: IntoIterator<Item = V>, V: Into<Value>>(
self,
examples: I,
) -> Self
pub fn examples<I: IntoIterator<Item = V>, V: Into<Value>>( self, examples: I, ) -> Self
Add or change example shown in UI of the value for richer documentation.
Sourcepub fn default_value(self, default: Value) -> Self
pub fn default_value(self, default: Value) -> Self
Add or change default value for the object which is provided when user has not provided the input in Swagger UI.
Sourcepub fn unique_items(self, unique_items: bool) -> Self
pub fn unique_items(self, unique_items: bool) -> Self
Set or change whether Array should enforce all items to be unique.
Sourcepub fn content_encoding<S: Into<String>>(self, content_encoding: S) -> Self
pub fn content_encoding<S: Into<String>>(self, content_encoding: S) -> Self
Set or change Array::content_encoding. Typically left empty but could be base64 for
example.
Sourcepub fn content_media_type<S: Into<String>>(self, content_media_type: S) -> Self
pub fn content_media_type<S: Into<String>>(self, content_media_type: S) -> Self
Set or change Array::content_media_type. Value must be valid MIME type e.g.
application/json.