Struct utoipa::openapi::schema::OneOfBuilder

source ·
pub struct OneOfBuilder { /* private fields */ }
Expand description

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

Implementations§

source§

impl OneOfBuilder

source

pub fn new() -> OneOfBuilder

Constructs a new OneOfBuilder.

source

pub fn build(self) -> OneOf

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

source§

impl OneOfBuilder

source

pub fn item<I: Into<RefOr<Schema>>>(self, component: I) -> Self

Adds a given Schema to OneOf Composite Object

source

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

Add or change the title of the OneOf.

source

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

Add or change optional description for OneOf component.

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 example(self, example: Option<Value>) -> Self

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

source

pub fn discriminator(self, discriminator: Option<Discriminator>) -> Self

Add or change discriminator field of the composite OneOf type.

source

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

Add or change nullable flag for Object.

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 OneOfBuilder

source§

fn default() -> Self

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

impl From<OneOf> for OneOfBuilder

source§

fn from(value: OneOf) -> Self

Converts to this type from the input type.
source§

impl From<OneOfBuilder> for OneOf

source§

fn from(value: OneOfBuilder) -> Self

Converts to this type from the input type.
source§

impl From<OneOfBuilder> for RefOr<Schema>

source§

fn from(one_of: OneOfBuilder) -> Self

Converts to this type from the input type.
source§

impl From<OneOfBuilder> for Schema

source§

fn from(builder: OneOfBuilder) -> 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>,

§

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

§

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.