[][src]Struct schemars::schema::SchemaObject

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

A JSON Schema object.

Fields

metadata: Option<Box<Metadata>>

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>>const_value: Option<Value>subschemas: Option<Box<SubschemaValidation>>

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

number: Option<Box<NumberValidation>>

Properties of the SchemaObject which define validation assertions for numbers.

string: Option<Box<StringValidation>>

Properties of the SchemaObject which define validation assertions for strings.

array: Option<Box<ArrayValidation>>

Properties of the SchemaObject which define validation assertions for arrays.

object: Option<Box<ObjectValidation>>

Properties of the SchemaObject which define validation assertions for objects.

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

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

Implementations

impl SchemaObject[src]

pub fn new_ref(reference: String) -> Self[src]

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.

pub fn is_ref(&self) -> bool[src]

Returns true if self is a $ref schema.

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

pub fn metadata(&mut self) -> &mut Metadata[src]

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

pub fn subschemas(&mut self) -> &mut SubschemaValidation[src]

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

pub fn number(&mut self) -> &mut NumberValidation[src]

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

pub fn string(&mut self) -> &mut StringValidation[src]

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

pub fn array(&mut self) -> &mut ArrayValidation[src]

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

pub fn object(&mut self) -> &mut ObjectValidation[src]

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

Trait Implementations

impl Clone for SchemaObject[src]

impl Debug for SchemaObject[src]

impl Default for SchemaObject[src]

impl<'de> Deserialize<'de> for SchemaObject where
    SchemaObject: Default
[src]

impl From<Schema> for SchemaObject[src]

impl From<SchemaObject> for Schema[src]

impl JsonSchema for SchemaObject[src]

impl PartialEq<SchemaObject> for SchemaObject[src]

impl Serialize for SchemaObject[src]

impl StructuralPartialEq for SchemaObject[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> DynClone for T where
    T: Clone
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.