Array

Struct Array 

Source
#[non_exhaustive]
pub struct Array { pub schema_type: SchemaType, pub title: Option<String>, pub items: Box<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 extensions: BTreeMap<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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§schema_type: SchemaType

Type will always be SchemaType::Array

§title: Option<String>

Changes the Array title.

§items: Box<RefOr<Schema>>

Schema representing the array items type.

§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: bool

Setting this to true will validate successfully if all elements of this Array are unique.

§xml: Option<Xml>

Xml format of the array.

§extensions: BTreeMap<String, Value>

Optional extensions x-something.

Implementations§

Source§

impl Array

Source

pub fn new() -> Array

Construct a new Array component from given Schema.

§Examples

Create a String array component.

let string_array = Array::new().items(Object::with_type(BasicType::String));
Source

pub fn items<I>(self, items: I) -> Array
where I: Into<RefOr<Schema>>,

Set Schema type for the Array.

Source

pub fn schema_type<T>(self, schema_type: T) -> Array
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 _ = Array::new()
    .schema_type(SchemaType::from_iter([BasicType::Array, BasicType::Null]))
    .items(Object::with_type(BasicType::String));
Source

pub fn title(self, title: impl Into<String>) -> Array

Add or change the title of the Array.

Source

pub fn description(self, description: impl Into<String>) -> Array

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

Source

pub fn deprecated(self, deprecated: Deprecated) -> Array

Add or change deprecated status for Array.

Source

pub fn example<V>(self, example: V) -> Array
where V: Into<Value>,

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

Source

pub fn examples<I, V>(self, examples: I) -> Array
where I: IntoIterator<Item = V>, V: Into<Value>,

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

Source

pub fn default_value(self, default: Value) -> Array

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: usize) -> Array

Set maximum allowed length for Array.

Source

pub fn min_items(self, min_items: usize) -> Array

Set minimum allowed length for Array.

Source

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

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

Source

pub fn xml(self, xml: Xml) -> Array

Set Xml formatting for Array.

Source

pub fn add_extension<K>(self, key: K, value: Value) -> Array
where K: Into<String>,

Add openapi extension (x-something) for Array.

Trait Implementations§

Source§

impl Clone for Array

Source§

fn clone(&self) -> Array

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Array

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for Array

Source§

fn default() -> Array

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

impl<'de> Deserialize<'de> for Array

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Array, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<Array> for AdditionalProperties<Schema>

Source§

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

Converts to this type from the input type.
Source§

impl From<Array> for RefOr<Schema>

Source§

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

Converts to this type from the input type.
Source§

impl From<Array> for Schema

Source§

fn from(array: Array) -> Schema

Converts to this type from the input type.
Source§

impl PartialEq for Array

Source§

fn eq(&self, other: &Array) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Array

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Array

Auto Trait Implementations§

§

impl Freeze for Array

§

impl RefUnwindSafe for Array

§

impl Send for Array

§

impl Sync for Array

§

impl Unpin for Array

§

impl UnwindSafe for Array

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<Data> ApiSuccessResponse for Data

Source§

fn api_response<Meta>(self, meta: Option<Meta>) -> ApiResponse<Self, Meta>

Source§

fn api_response_without_meta<Meta>(self) -> ApiResponse<Self, Meta>

Source§

fn api_response_with_meta<Meta>(self, meta: Meta) -> ApiResponse<Self, Meta>

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

Source§

fn len(&self) -> usize

The number of items that this chain link consists of.
Source§

fn append_to(self, v: &mut Vec<T>)

Append the elements in this link to the chain.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Container<T> for T
where T: Clone,

Source§

type Iter = Once<T>

An iterator over the items within this container, by value.
Source§

fn get_iter(&self) -> <T as Container<T>>::Iter

Iterate over the elements of the container (using internal iteration because GATs are unstable).
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<T> FutureTraceExt for T
where T: FutureExt,

Source§

fn with_current_context_span(self, otel_span: Span) -> WithContext<Self>

Pass the span of opentelemetry to the current context of tracing.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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
Source§

impl<T> Any for T
where T: Any,

Source§

impl<T> CloneAny for T
where T: Any + Clone,

Source§

impl<T> CloneAnySend for T
where T: Any + Send + Clone,

Source§

impl<T> CloneAnySendSync for T
where T: Any + Send + Sync + Clone,

Source§

impl<T> CloneAnySync for T
where T: Any + Sync + Clone,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> ModuleInterface for T
where T: Any + Send + Sync,

Source§

impl<T> OrderedContainer<T> for T
where T: Clone,

Source§

impl<T> SendSyncUnwindSafe for T
where T: Send + Sync + UnwindSafe + ?Sized,