Skip to main content

SchemaObject

Struct SchemaObject 

Source
pub struct SchemaObject {
Show 61 fields pub schema_dialect: Option<String>, pub id: Option<String>, pub reference: Option<String>, pub anchor: Option<String>, pub dynamic_ref: Option<String>, pub dynamic_anchor: Option<String>, pub comment: Option<String>, pub defs: Map<Schema>, pub all_of: Option<Vec<Schema>>, pub any_of: Option<Vec<Schema>>, pub one_of: Option<Vec<Schema>>, pub not: Option<Box<Schema>>, pub if_schema: Option<Box<Schema>>, pub then_schema: Option<Box<Schema>>, pub else_schema: Option<Box<Schema>>, pub dependent_schemas: Map<Schema>, pub prefix_items: Option<Vec<Schema>>, pub items: Option<Box<Schema>>, pub contains: Option<Box<Schema>>, pub properties: Map<Schema>, pub pattern_properties: Map<Schema>, pub additional_properties: Option<Box<Schema>>, pub property_names: Option<Box<Schema>>, pub unevaluated_items: Option<Box<Schema>>, pub unevaluated_properties: Option<Box<Schema>>, pub ty: Option<TypeSet>, pub const_value: Option<Value>, pub enumeration: Option<Vec<Value>>, pub multiple_of: Option<f64>, pub maximum: Option<f64>, pub exclusive_maximum: Option<f64>, pub minimum: Option<f64>, pub exclusive_minimum: Option<f64>, pub max_length: Option<u64>, pub min_length: Option<u64>, pub pattern: Option<String>, pub max_items: Option<u64>, pub min_items: Option<u64>, pub unique_items: Option<bool>, pub max_contains: Option<u64>, pub min_contains: Option<u64>, pub max_properties: Option<u64>, pub min_properties: Option<u64>, pub required: Option<Vec<String>>, pub dependent_required: Map<Vec<String>>, pub format: Option<String>, pub content_encoding: Option<String>, pub content_media_type: Option<String>, pub content_schema: Option<Box<Schema>>, pub title: Option<String>, pub description: Option<String>, pub default: Option<Value>, pub deprecated: Option<bool>, pub read_only: Option<bool>, pub write_only: Option<bool>, pub examples: Option<Vec<Value>>, pub discriminator: Option<Discriminator>, pub xml: Option<Xml>, pub external_docs: Option<ExternalDocumentation>, pub example: Option<Value>, pub unknown_keywords: Map<Value>,
}
Expand description

A schema with keywords.

Keywords are grouped below in the order the JSON Schema 2020-12 specification presents them: core, applicator, unevaluated, validation, format, content, metadata; then the four keywords of the OAS base vocabulary.

Unrecognized keywords are preserved in unknown_keywords rather than dropped, because JSON Schema is extensible by design and a description parsed from an external source must round-trip.

Fields§

§schema_dialect: Option<String>

The dialect this schema resource is written in.

Permitted only on a schema resource root. When absent, the document’s json_schema_dialect applies.

§id: Option<String>

The base URI of this schema resource.

§reference: Option<String>

A reference to another schema, applied together with any siblings.

§anchor: Option<String>

A plain-name fragment identifying this schema within its resource.

§dynamic_ref: Option<String>

A reference resolved dynamically against the evaluation path.

§dynamic_anchor: Option<String>

A dynamic anchor, the target of a $dynamicRef.

§comment: Option<String>

A comment for maintainers, carrying no validation effect.

§defs: Map<Schema>

Reusable subschemas.

These are not visible to OpenAPI component-name resolution: a Discriminator implicit mapping and a #/components/schemas lookup cannot see entries defined here.

§all_of: Option<Vec<Schema>>

The instance must validate against every subschema.

§any_of: Option<Vec<Schema>>

The instance must validate against at least one subschema.

§one_of: Option<Vec<Schema>>

The instance must validate against exactly one subschema.

§not: Option<Box<Schema>>

The instance must not validate against this subschema.

§if_schema: Option<Box<Schema>>

The condition of a conditional schema.

§then_schema: Option<Box<Schema>>

Applied when if_schema succeeds.

§else_schema: Option<Box<Schema>>

Applied when if_schema fails.

§dependent_schemas: Map<Schema>

Schemas applied when a given property is present.

§prefix_items: Option<Vec<Schema>>

Schemas applied to the array items at the corresponding positions.

§items: Option<Box<Schema>>

The schema applied to array items past prefix_items.

§contains: Option<Box<Schema>>

At least one array item must validate against this schema.

§properties: Map<Schema>

Schemas applied to named object properties.

§pattern_properties: Map<Schema>

Schemas applied to properties whose names match a regular expression.

§additional_properties: Option<Box<Schema>>

The schema applied to properties matched by no other applicator.

§property_names: Option<Box<Schema>>

A schema every property name must validate against.

§unevaluated_items: Option<Box<Schema>>

Applied to array items no other applicator evaluated.

§unevaluated_properties: Option<Box<Schema>>

Applied to properties no other applicator evaluated.

§ty: Option<TypeSet>

The permitted primitive type or types.

§const_value: Option<Value>

The instance must equal this value.

§enumeration: Option<Vec<Value>>

The instance must equal one of these values.

§multiple_of: Option<f64>

The number must be a multiple of this value.

§maximum: Option<f64>

The inclusive upper bound of a number.

§exclusive_maximum: Option<f64>

The exclusive upper bound of a number.

A number from OpenAPI 3.1 onward. In 3.0 this was a boolean modifying maximum; that form must never be emitted.

§minimum: Option<f64>

The inclusive lower bound of a number.

§exclusive_minimum: Option<f64>

The exclusive lower bound of a number.

§max_length: Option<u64>

The maximum length of a string, in Unicode scalar values.

§min_length: Option<u64>

The minimum length of a string, in Unicode scalar values.

§pattern: Option<String>

An ECMA-262 regular expression the string must match.

§max_items: Option<u64>

The maximum number of array items.

§min_items: Option<u64>

The minimum number of array items.

§unique_items: Option<bool>

Whether array items must be pairwise distinct.

§max_contains: Option<u64>

The maximum number of items matching contains.

§min_contains: Option<u64>

The minimum number of items matching contains.

§max_properties: Option<u64>

The maximum number of object properties.

§min_properties: Option<u64>

The minimum number of object properties.

§required: Option<Vec<String>>

The names of properties that must be present.

§dependent_required: Map<Vec<String>>

Properties required when a given property is present.

§format: Option<String>

A semantic format annotation such as date-time or uuid.

Non-validating by default. OpenAPI itself defines only int32, int64, float, double and password; everything else comes from the OAI Format Registry and support for it is optional.

§content_encoding: Option<String>

How the string is encoded, such as base64.

Together with content_media_type this replaces the OpenAPI 3.0 format: binary, which must never be emitted.

§content_media_type: Option<String>

The media type of the string’s decoded contents.

§content_schema: Option<Box<Schema>>

A schema for the string’s decoded contents.

§title: Option<String>

A short title for the schema.

§description: Option<String>

A description of the schema. CommonMark syntax may be used.

§default: Option<Value>

The default value for the described instance.

§deprecated: Option<bool>

Whether the described instance is deprecated.

§read_only: Option<bool>

The instance is sent by the server but not accepted from the client.

§write_only: Option<bool>

The instance is accepted from the client but not sent by the server.

§examples: Option<Vec<Value>>

Example instances.

An array, per JSON Schema. This supersedes the OAS example field.

§discriminator: Option<Discriminator>

Polymorphism support for oneOf, anyOf and allOf.

§xml: Option<Xml>

Metadata describing the XML representation of this schema.

§external_docs: Option<ExternalDocumentation>

Additional external documentation for this schema.

§example: Option<Value>
👎Deprecated:

use examples, which the specification supersedes this with

A single example instance.

Deprecated by the specification in favour of examples. Present so that parsed descriptions round-trip; Kynos does not emit it.

§unknown_keywords: Map<Value>

Keywords not recognized by this model.

Note that inside a Schema Object — and nowhere else — extensions are permitted to omit the x- prefix, so this map is not purely a specification-extension container.

Trait Implementations§

Source§

impl Clone for SchemaObject

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for SchemaObject

Source§

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

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

impl Default for SchemaObject

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for SchemaObject

Source§

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

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

impl PartialEq for SchemaObject

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Serialize for SchemaObject

Source§

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

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

impl StructuralPartialEq for SchemaObject

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> 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> 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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.