ArrayBuilder

Struct ArrayBuilder 

Source
pub struct ArrayBuilder { /* private fields */ }
Expand description

Builder for Array with chainable configuration methods to create a new Array.

Implementations§

Source§

impl ArrayBuilder

Source

pub fn new() -> ArrayBuilder

Constructs a new ArrayBuilder.

Source

pub fn build(self) -> Array

Constructs a new Array taking all fields values from this object.

Source§

impl ArrayBuilder

Source

pub fn items<I: Into<ArrayItems>>(self, items: I) -> Self

Set Schema type for the Array.

Source

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.

Source

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();
Source

pub fn title<I: Into<String>>(self, title: Option<I>) -> Self

Add or change the title of the Array.

Source

pub fn description<I: Into<String>>(self, description: Option<I>) -> Self

Add or change description of the property. Markdown syntax is supported.

Source

pub fn deprecated(self, deprecated: Option<Deprecated>) -> Self

Add or change deprecated status for Array.

Source

pub fn example(self, example: Option<Value>) -> Self

👎Deprecated: Since OpenAPI 3.1 prefer using examples

Add or change example shown in UI of the value for richer documentation.

Deprecated since 3.0.x. Prefer Array::examples instead

Source

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.

Source

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.

Source

pub fn max_items(self, max_items: Option<usize>) -> Self

Set maximum allowed length for Array.

Source

pub fn min_items(self, min_items: Option<usize>) -> Self

Set minimum allowed length for Array.

Source

pub fn unique_items(self, unique_items: bool) -> Self

Set or change whether Array should enforce all items to be unique.

Source

pub fn xml(self, xml: Option<Xml>) -> Self

Set Xml formatting for Array.

Source

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.

Source

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.

Source

pub fn extensions(self, extensions: Option<Extensions>) -> Self

Add openapi extensions (x-something) for Array.

Source

pub fn to_array_builder(self) -> ArrayBuilder

Construct a new ArrayBuilder with this component set to ArrayBuilder::items.

Trait Implementations§

Source§

impl Default for ArrayBuilder

Source§

fn default() -> Self

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

impl From<Array> for ArrayBuilder

Source§

fn from(value: Array) -> Self

Converts to this type from the input type.
Source§

impl From<ArrayBuilder> for AdditionalProperties<Schema>

Source§

fn from(value: ArrayBuilder) -> Self

Converts to this type from the input type.
Source§

impl From<ArrayBuilder> for Array

Source§

fn from(value: ArrayBuilder) -> Self

Converts to this type from the input type.
Source§

impl From<ArrayBuilder> for ArrayItems

Source§

fn from(value: ArrayBuilder) -> Self

Converts to this type from the input type.
Source§

impl From<ArrayBuilder> for RefOr<Schema>

Source§

fn from(array: ArrayBuilder) -> Self

Converts to this type from the input type.
Source§

impl From<ArrayBuilder> for Schema

Source§

fn from(builder: ArrayBuilder) -> Self

Converts to this type from the input type.

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> 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, 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.