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

pub enum Form {
    Empty,
    Ref(Option<Url>, Option<String>),
    Type(Type),
    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(Option<Url>, Option<String>)

The ref form.

This schema refers to another schema, and does whatever that other schema does.

The first parameter is the URI of the root schema that the referred-to schema belongs to. It is None if the schema referred to lacks an ID.

The second parameter is the definition of the referred-to schema. If the reference isn't to any definition at all (i.e. the reference is to a root schema, not a definition), then it is None.

Type(Type)

The type form.

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

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 Clone for Form[src]

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

Performs copy-assignment from source. Read more

impl PartialEq<Form> for Form[src]

impl Debug for Form[src]

Auto Trait Implementations

impl Send for Form

impl Sync for Form

Blanket Implementations

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> From for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

impl<T, U> TryInto 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> Any for T where
    T: 'static + ?Sized
[src]