pub struct SchemaObject {
    pub metadata: Option<Box<Metadata, Global>>,
    pub instance_type: Option<SingleOrVec<InstanceType>>,
    pub format: Option<String>,
    pub enum_values: Option<Vec<Value, Global>>,
    pub const_value: Option<Value>,
    pub subschemas: Option<Box<SubschemaValidation, Global>>,
    pub number: Option<Box<NumberValidation, Global>>,
    pub string: Option<Box<StringValidation, Global>>,
    pub array: Option<Box<ArrayValidation, Global>>,
    pub object: Option<Box<ObjectValidation, Global>>,
    pub reference: Option<String>,
    pub extensions: BTreeMap<String, Value>,
}
Expand description

A JSON Schema object.

Fields

metadata: Option<Box<Metadata, Global>>

Properties which annotate the SchemaObject which typically have no effect when an object is being validated against the schema.

instance_type: Option<SingleOrVec<InstanceType>>format: Option<String>enum_values: Option<Vec<Value, Global>>const_value: Option<Value>subschemas: Option<Box<SubschemaValidation, Global>>

Properties of the SchemaObject which define validation assertions in terms of other schemas.

number: Option<Box<NumberValidation, Global>>

Properties of the SchemaObject which define validation assertions for numbers.

string: Option<Box<StringValidation, Global>>

Properties of the SchemaObject which define validation assertions for strings.

array: Option<Box<ArrayValidation, Global>>

Properties of the SchemaObject which define validation assertions for arrays.

object: Option<Box<ObjectValidation, Global>>

Properties of the SchemaObject which define validation assertions for objects.

reference: Option<String>extensions: BTreeMap<String, Value>

Arbitrary extra properties which are not part of the JSON Schema specification, or which schemars does not support.

Implementations

Creates a new $ref schema.

The given reference string should be a URI reference. This will usually be a JSON Pointer in URI Fragment representation.

Returns true if self is a $ref schema.

If self has Some reference set, this returns true. Otherwise, returns false.

Returns a mutable reference to this schema’s Metadata, creating it if it was None.

Returns a mutable reference to this schema’s SubschemaValidation, creating it if it was None.

Returns a mutable reference to this schema’s NumberValidation, creating it if it was None.

Returns a mutable reference to this schema’s StringValidation, creating it if it was None.

Returns a mutable reference to this schema’s ArrayValidation, creating it if it was None.

Returns a mutable reference to this schema’s ObjectValidation, creating it if it was None.

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

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

Deserialize this value from the given Serde deserializer. Read more

Converts to this type from the input type.

Converts to this type from the input type.

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

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

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.

Should always be Self

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.