[][src]Enum jddf::schema::Form

pub enum Form {
    Empty,
    Ref(String),
    Type(Type),
    Enum(HashSet<String>),
    Elements(Schema),
    Properties {
        required: HashMap<String, Schema>,
        optional: HashMap<String, Schema>,
        allow_additional: bool,
        has_required: 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.

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

The properties form.

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

required is the set of required properties and their schemas. optional is the set of optional properties and their schemas. allow_additional indicates whether it's acceptable for the instance to have properties other than those mentioned in required and optional.

has_required 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.

Fields of Properties

required: HashMap<String, Schema>optional: HashMap<String, Schema>allow_additional: boolhas_required: bool
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]

impl Debug for Form[src]

impl PartialEq<Form> for Form[src]

impl StructuralPartialEq for Form[src]

Auto Trait Implementations

impl RefUnwindSafe for Form

impl Send for Form

impl Sync for Form

impl Unpin for Form

impl UnwindSafe for Form

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> 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.