[][src]Enum jsl::schema::Form

pub enum Form {
    Empty,
    Ref(String),
    Type(Type),
    Enum(HashSet<String>),
    Elements(Schema),
    Properties(HashMap<String, Schema>, HashMap<String, Schema>, bool),
    Values(Schema),
    Discriminator(StringHashMap<String, Schema>),
}

The various forms which a schema may take on, and their respective data.

Variants

Empty

The empty form.

This schema accepts all data.

Ref(String)

The ref form.

This schema refers to another schema, and does whatever that other schema does. The contained string is the name of the definition of the referred-to schema -- it is an index into the defs of the root schema.

Type(Type)

The type form.

This schema asserts that the data is one of the primitive types.

Enum(HashSet<String>)

The enum form.

This schema asserts that the data is a string, and that it is one of a set of values.

Elements(Schema)

The elements form.

This schema asserts that the instance is an array, and that every element of the array matches a given schema.

Properties(HashMap<String, Schema>, HashMap<String, Schema>, bool)

The properties form.

This schema asserts that the instance is an object, and that the properties all satisfy their respective schemas.

The first map is the set of required properties and their schemas. The second map is the set of optional properties and their schemas.

The final property indicates whether properties exists on the schema. This allows implementations to distinguish the case of an empty properties field from an omitted one. This is necessary for tooling which wants to link to a particular part of a schema in JSON form.

Values(Schema)

The values form.

This schema asserts that the instance is an object, and that all the values in the object all satisfy the same schema.

Discriminator(StringHashMap<String, Schema>)

The discriminator form.

This schema asserts that the instance is an object, and that it has a "tag" property. The value of that tag must be one of the expected "mapping" keys, and the corresponding mapping value is a schema that the instance is expected to satisfy.

The first parameter is the name of the tag property. The second parameter is the mapping from tag values to their corresponding schemas.

Trait Implementations

impl PartialEq<Form> for Form[src]

impl Clone for Form[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Form[src]

Auto Trait Implementations

impl Unpin for Form

impl Sync for Form

impl Send for Form

impl RefUnwindSafe for Form

impl UnwindSafe for Form

Blanket Implementations

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

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

type Owned = T

The resulting type after obtaining ownership.

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

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.

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

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

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