Struct utoipa::openapi::schema::ObjectBuilder

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

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

Implementations§

source§

impl ObjectBuilder

source

pub fn new() -> ObjectBuilder

Constructs a new ObjectBuilder.

source

pub fn build(self) -> Object

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

source§

impl ObjectBuilder

source

pub fn schema_type(self, schema_type: SchemaType) -> Self

Add or change type of the object e.g SchemaType::String.

source

pub fn format(self, format: Option<SchemaFormat>) -> Self

Add or change additional format for detailing the schema type.

source

pub fn property<S: Into<String>, I: Into<RefOr<Schema>>>( self, property_name: S, component: I, ) -> Self

Add new property to the Object.

Method accepts property name and property component as an arguments.

source

pub fn additional_properties<I: Into<AdditionalProperties<Schema>>>( self, additional_properties: Option<I>, ) -> Self

source

pub fn required<I: Into<String>>(self, required_field: I) -> Self

Add field to the required fields of Object.

source

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

Add or change the title of the Object.

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 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 deprecated(self, deprecated: Option<Deprecated>) -> Self

Add or change deprecated status for Object.

source

pub fn enum_values<I: IntoIterator<Item = E>, E: Into<Value>>( self, enum_values: Option<I>, ) -> Self

Add or change enum property variants.

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 write_only(self, write_only: Option<bool>) -> Self

Add or change write only flag for Object.

source

pub fn read_only(self, read_only: Option<bool>) -> Self

Add or change read only flag for Object.

source

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

Add or change additional Xml formatting of the Object.

source

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

Add or change nullable flag for Object.

source

pub fn multiple_of(self, multiple_of: Option<f64>) -> Self

Set or change multiple_of validation flag for number and integer type values.

source

pub fn maximum(self, maximum: Option<f64>) -> Self

Set or change inclusive maximum value for number and integer values.

source

pub fn minimum(self, minimum: Option<f64>) -> Self

Set or change inclusive minimum value for number and integer values.

source

pub fn exclusive_maximum(self, exclusive_maximum: Option<f64>) -> Self

Set or change exclusive maximum value for number and integer values.

source

pub fn exclusive_minimum(self, exclusive_minimum: Option<f64>) -> Self

Set or change exclusive minimum value for number and integer values.

source

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

Set or change maximum length for string values.

source

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

Set or change minimum length for string values.

source

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

Set or change a valid regular expression for string value to match.

source

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

Set or change maximum number of properties the Object can hold.

source

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

Set or change minimum number of properties the Object can hold.

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 ObjectBuilder

source§

fn default() -> Self

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

impl From<Object> for ObjectBuilder

source§

fn from(value: Object) -> Self

Converts to this type from the input type.
source§

impl From<ObjectBuilder> for AdditionalProperties<Schema>

source§

fn from(value: ObjectBuilder) -> Self

Converts to this type from the input type.
source§

impl From<ObjectBuilder> for Object

source§

fn from(value: ObjectBuilder) -> Self

Converts to this type from the input type.
source§

impl From<ObjectBuilder> for RefOr<Schema>

source§

fn from(builder: ObjectBuilder) -> Self

Converts to this type from the input type.
source§

impl From<ObjectBuilder> for Schema

source§

fn from(builder: ObjectBuilder) -> 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.