#[non_exhaustive]pub struct AnyOf {
pub items: Vec<RefOr<Schema>>,
pub schema_type: SchemaType,
pub title: Option<String>,
pub description: Option<String>,
pub default_value: Option<Value>,
pub examples: Vec<Value>,
pub discriminator: Option<Discriminator>,
pub extensions: PropMap<String, Value>,
}Expand description
AnyOf Composite Object component holds multiple components together where API endpoint will return a combination of all of them.
See Schema::AnyOf 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.items: Vec<RefOr<Schema>>Components of AnyOf component.
schema_type: SchemaTypeType of AnyOf e.g. SchemaType::basic(BasicType::Object) for object.
By default this is SchemaType::AnyValue as the type is defined by items
themselves.
title: Option<String>Changes the AnyOf title.
description: Option<String>Description of the AnyOf. Markdown syntax is supported.
default_value: Option<Value>Default value which is provided when user has not provided the input in Swagger UI.
examples: Vec<Value>Examples shown in UI of the value for richer documentation.
discriminator: Option<Discriminator>Optional discriminator field can be used to aid deserialization, serialization and validation of a specific schema.
extensions: PropMap<String, Value>Optional extensions x-something.
Implementations§
Source§impl AnyOf
impl AnyOf
Sourcepub fn new() -> Self
pub fn new() -> Self
Construct a new empty AnyOf. This is effectively same as calling AnyOf::default.
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Sourcepub fn item<I: Into<RefOr<Schema>>>(self, component: I) -> Self
pub fn item<I: Into<RefOr<Schema>>>(self, component: I) -> Self
Adds a given Schema to AnyOf Composite Object
Sourcepub fn schema_type<T: Into<SchemaType>>(self, schema_type: T) -> Self
pub fn schema_type<T: Into<SchemaType>>(self, schema_type: T) -> Self
Add or change type of the object e.g. to change type to string
use value SchemaType::Type(Type::String).
Sourcepub fn description(self, description: impl Into<String>) -> Self
pub fn description(self, description: impl Into<String>) -> Self
Add or change optional description for AnyOf component.
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 add_example<V: Into<Value>>(self, example: V) -> Self
pub fn add_example<V: Into<Value>>(self, example: V) -> Self
Add or change example shown in UI of the value for richer documentation.
Sourcepub fn discriminator(self, discriminator: Discriminator) -> Self
pub fn discriminator(self, discriminator: Discriminator) -> Self
Add or change discriminator field of the composite AnyOf type.