pub struct ArrayBuilder { /* private fields */ }Implementations§
Source§impl ArrayBuilder
impl ArrayBuilder
Sourcepub fn new() -> ArrayBuilder
pub fn new() -> ArrayBuilder
Constructs a new ArrayBuilder.
Source§impl ArrayBuilder
impl ArrayBuilder
Sourcepub fn prefix_items<I: IntoIterator<Item = S>, S: Into<Schema>>(
self,
items: I,
) -> Self
pub fn prefix_items<I: IntoIterator<Item = S>, S: Into<Schema>>( self, items: I, ) -> Self
Add prefix items of Array to define item validation of tuples according 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 _ = ArrayBuilder::new()
.schema_type(SchemaType::from_iter([Type::Array, Type::Null]))
.items(Object::with_type(Type::String))
.build();Sourcepub fn title<I: Into<String>>(self, title: Option<I>) -> Self
pub fn title<I: Into<String>>(self, title: Option<I>) -> Self
Add or change the title of the Array.
Sourcepub fn description<I: Into<String>>(self, description: Option<I>) -> Self
pub fn description<I: Into<String>>(self, description: Option<I>) -> Self
Add or change description of the property. Markdown syntax is supported.
Sourcepub fn deprecated(self, deprecated: Option<Deprecated>) -> Self
pub fn deprecated(self, deprecated: Option<Deprecated>) -> Self
Add or change deprecated status for Array.
Sourcepub fn example(self, example: Option<Value>) -> Self
👎Deprecated: Since OpenAPI 3.1 prefer using examples
pub fn example(self, example: Option<Value>) -> Self
examplesAdd or change example shown in UI of the value for richer documentation.
Deprecated since 3.0.x. Prefer Array::examples instead
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 examples shown in UI of the value for richer documentation.
Sourcepub fn default(self, default: Option<Value>) -> Self
pub fn default(self, default: Option<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 of change Object::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 of change Object::content_media_type. Value must be valid MIME type e.g.
application/json.
Sourcepub fn extensions(self, extensions: Option<Extensions>) -> Self
pub fn extensions(self, extensions: Option<Extensions>) -> Self
Add openapi extensions (x-something) for Array.
Sourcepub fn to_array_builder(self) -> ArrayBuilder
pub fn to_array_builder(self) -> ArrayBuilder
Construct a new ArrayBuilder with this component set to ArrayBuilder::items.