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>(self, items: I) -> ArrayBuilder
where I: Into<ArrayItems>,

Set Schema type for the Array.

Source

pub fn prefix_items<I, S>(self, items: I) -> ArrayBuilder
where I: IntoIterator<Item = S>, S: Into<Schema>,

Add prefix items of Array to define item validation of tuples according JSON schema item validation.

Source

pub fn schema_type<T>(self, schema_type: T) -> ArrayBuilder
where T: Into<SchemaType>,

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>(self, title: Option<I>) -> ArrayBuilder
where I: Into<String>,

Add or change the title of the Array.

Source

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

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

Source

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

Add or change deprecated status for Array.

Source

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

👎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, V>(self, examples: I) -> ArrayBuilder
where I: IntoIterator<Item = V>, V: Into<Value>,

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

Source

pub fn default(self, default: Option<Value>) -> ArrayBuilder

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>) -> ArrayBuilder

Set maximum allowed length for Array.

Source

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

Set minimum allowed length for Array.

Source

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

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

Source

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

Set Xml formatting for Array.

Source

pub fn content_encoding<S>(self, content_encoding: S) -> ArrayBuilder
where S: Into<String>,

Set of change Object::content_encoding. Typically left empty but could be base64 for example.

Source

pub fn content_media_type<S>(self, content_media_type: S) -> ArrayBuilder
where S: Into<String>,

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>) -> ArrayBuilder

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() -> ArrayBuilder

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

impl From<Array> for ArrayBuilder

Source§

fn from(value: Array) -> ArrayBuilder

Converts to this type from the input type.
Source§

impl From<ArrayBuilder> for AdditionalProperties<Schema>

Source§

fn from(value: ArrayBuilder) -> AdditionalProperties<Schema>

Converts to this type from the input type.
Source§

impl From<ArrayBuilder> for Array

Source§

fn from(value: ArrayBuilder) -> Array

Converts to this type from the input type.
Source§

impl From<ArrayBuilder> for ArrayItems

Source§

fn from(value: ArrayBuilder) -> ArrayItems

Converts to this type from the input type.
Source§

impl From<ArrayBuilder> for RefOr<Schema>

Source§

fn from(array: ArrayBuilder) -> RefOr<Schema>

Converts to this type from the input type.
Source§

impl From<ArrayBuilder> for Schema

Source§

fn from(builder: ArrayBuilder) -> Schema

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more