#[non_exhaustive]
pub struct OpenapiSchema { pub name: Option<String>, pub description: Option<String>, pub nullable: bool, pub schema: SchemaKind, pub dependencies: IndexMap<String, OpenapiSchema>, }
Expand description

This struct is used to generate the OpenAPI specification for a particular type. It is already made available for all primitives and some other types from the rust standard library, and you can also make your own types provide one through the OpenapiType trait and derive macro.

Note that this struct is marked non-exhaustive. This means that new attributes might be added at any point in time without a breaking change. The only way to obtain a value is through the OpenapiSchema::new method.

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.
name: Option<String>

The name of this schema. If it is None, the schema will be inlined.

description: Option<String>

The description of this schema. Optional and only makes sense when a name is set as well.

nullable: bool

Whether this particular schema is nullable. Note that there is no guarantee that this will make it into the final specification, it might just be interpreted as a hint to make it an optional parameter.

schema: SchemaKind

The actual OpenAPI schema.

dependencies: IndexMap<String, OpenapiSchema>

Other schemas that this schema depends on. They will be included in the final OpenAPI Spec along with this schema.

Implementations

Create a new schema that has no name.

Convert this schema to a Schema that can be serialized to the OpenAPI Spec.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.