pub struct ValidationVocabulary {Show 20 fields
pub type_: Option<TypeValue>,
pub enum_: Option<Vec<Value>>,
pub const_: Option<Value>,
pub minimum: Option<Number>,
pub maximum: Option<Number>,
pub exclusive_minimum: Option<Number>,
pub exclusive_maximum: Option<Number>,
pub multiple_of: Option<Number>,
pub min_length: Option<u64>,
pub max_length: Option<u64>,
pub pattern: Option<String>,
pub min_items: Option<u64>,
pub max_items: Option<u64>,
pub unique_items: bool,
pub min_contains: Option<u64>,
pub max_contains: Option<u64>,
pub required: Option<Vec<String>>,
pub min_properties: Option<u64>,
pub max_properties: Option<u64>,
pub dependent_required: Option<IndexMap<String, Vec<String>>>,
}Expand description
Validation vocabulary — type checks and numeric, string, array, and object constraints.
Fields§
§type_: Option<TypeValue>The type keyword — instance type constraint.
The value of this keyword MUST be either a string or an array. If it is an array, elements of the array MUST be strings and MUST be unique.
String values MUST be one of the six primitive types ("null",
"boolean", "object", "array", "number", or "string"),
or "integer" which matches any number with a zero fractional
part.
If the value of "type" is a string, then an instance validates
successfully if its type matches the type represented by the
value of the string. If the value of "type" is an array, then
an instance validates successfully if its type matches any of the
types indicated by the strings in the array.
enum_: Option<Vec<Value>>The enum keyword — enumerated values constraint.
The value of this keyword MUST be an array. This array SHOULD have at least one element. Elements in the array SHOULD be unique.
An instance validates successfully against this keyword if its value is equal to one of the elements in this keyword’s array value.
Elements in the array might be of any type, including null.
const_: Option<Value>The const keyword — constant value constraint.
The value of this keyword MAY be of any type, including null.
Use of this keyword is functionally equivalent to an "enum"
(Section 6.1.2) with a single value.
An instance validates successfully against this keyword if its value is equal to the value of the keyword.
minimum: Option<Number>The minimum keyword — inclusive lower bound.
The value of "minimum" MUST be a number, representing an
inclusive lower limit for a numeric instance.
If the instance is a number, then this keyword validates only if
the instance is greater than or exactly equal to "minimum".
maximum: Option<Number>The maximum keyword — inclusive upper bound.
The value of "maximum" MUST be a number, representing an
inclusive upper limit for a numeric instance.
If the instance is a number, then this keyword validates only if
the instance is less than or exactly equal to "maximum".
exclusive_minimum: Option<Number>The exclusiveMinimum keyword — exclusive lower bound.
The value of "exclusiveMinimum" MUST be a number, representing
an exclusive lower limit for a numeric instance.
If the instance is a number, then the instance is valid only if
it has a value strictly greater than (not equal to)
"exclusiveMinimum".
exclusive_maximum: Option<Number>The exclusiveMaximum keyword — exclusive upper bound.
The value of "exclusiveMaximum" MUST be a number, representing
an exclusive upper limit for a numeric instance.
If the instance is a number, then the instance is valid only if
it has a value strictly less than (not equal to)
"exclusiveMaximum".
multiple_of: Option<Number>The multipleOf keyword — divisibility constraint.
The value of "multipleOf" MUST be a number, strictly greater
than 0.
A numeric instance is valid only if division by this keyword’s value results in an integer.
min_length: Option<u64>The minLength keyword — minimum string length.
The value of this keyword MUST be a non-negative integer.
A string instance is valid against this keyword if its length is greater than, or equal to, the value of this keyword.
The length of a string instance is defined as the number of its characters as defined by RFC 8259.
Omitting this keyword has the same behavior as a value of 0.
max_length: Option<u64>The maxLength keyword — maximum string length.
The value of this keyword MUST be a non-negative integer.
A string instance is valid against this keyword if its length is less than, or equal to, the value of this keyword.
The length of a string instance is defined as the number of its characters as defined by RFC 8259.
pattern: Option<String>The pattern keyword — regex constraint.
The value of this keyword MUST be a string. This string SHOULD be a valid regular expression, according to the ECMA-262 regular expression dialect.
A string instance is considered valid if the regular expression matches the instance successfully. Recall: regular expressions are not implicitly anchored.
min_items: Option<u64>The minItems keyword — minimum array length.
The value of this keyword MUST be a non-negative integer.
An array instance is valid against "minItems" if its size is
greater than, or equal to, the value of this keyword.
Omitting this keyword has the same behavior as a value of 0.
max_items: Option<u64>The maxItems keyword — maximum array length.
The value of this keyword MUST be a non-negative integer.
An array instance is valid against "maxItems" if its size is
less than, or equal to, the value of this keyword.
unique_items: boolThe uniqueItems keyword — array element uniqueness.
The value of this keyword MUST be a boolean.
If this keyword has boolean value false, the instance validates successfully. If it has boolean value true, the instance validates successfully if all of its elements are unique.
Omitting this keyword has the same behavior as a value of false.
min_contains: Option<u64>The minContains keyword — minimum contains matches.
The value of this keyword MUST be a non-negative integer.
If "contains" is not present within the same schema object,
then this keyword has no effect.
An instance array is valid against "minContains" in two ways,
depending on the form of the annotation result of an adjacent
"contains" keyword. The first way is if the annotation result
is an array and the length of that array is greater than or
equal to the "minContains" value. The second way is if the
annotation result is a boolean true and the instance array
length is greater than or equal to the "minContains" value.
A value of 0 is allowed, but is only useful for setting a range
of occurrences from 0 to the value of "maxContains". A value
of 0 causes "minContains" and "contains" to always pass
validation (but validation can still fail against a
"maxContains" keyword).
Omitting this keyword has the same behavior as a value of 1.
max_contains: Option<u64>The maxContains keyword — maximum contains matches.
The value of this keyword MUST be a non-negative integer.
If "contains" is not present within the same schema object,
then this keyword has no effect.
An instance array is valid against "maxContains" in two ways,
depending on the form of the annotation result of an adjacent
"contains" keyword. The first way is if the annotation result
is an array and the length of that array is less than or equal
to the "maxContains" value. The second way is if the
annotation result is a boolean true and the instance array
length is less than or equal to the "maxContains" value.
required: Option<Vec<String>>The required keyword — required property names.
The value of this keyword MUST be an array. Elements of this array, if any, MUST be strings, and MUST be unique.
An object instance is valid against this keyword if every item in the array is the name of a property in the instance.
Omitting this keyword has the same behavior as an empty array.
min_properties: Option<u64>The minProperties keyword — minimum property count.
The value of this keyword MUST be a non-negative integer.
An object instance is valid against "minProperties" if its
number of properties is greater than, or equal to, the value of
this keyword.
Omitting this keyword has the same behavior as a value of 0.
max_properties: Option<u64>The maxProperties keyword — maximum property count.
The value of this keyword MUST be a non-negative integer.
An object instance is valid against "maxProperties" if its
number of properties is less than, or equal to, the value of
this keyword.
dependent_required: Option<IndexMap<String, Vec<String>>>The dependentRequired keyword — conditional required
properties.
The value of this keyword MUST be an object. Properties in this object, if any, MUST be arrays. Elements in each array, if any, MUST be strings, and MUST be unique.
This keyword specifies properties that are required if a specific other property is present. Their requirement is dependent on the presence of the other property.
Validation succeeds if, for each name that appears in both the instance and as a name within this keyword’s value, every item in the corresponding array is also the name of a property in the instance.
Omitting this keyword has the same behavior as an empty object.
Trait Implementations§
Source§impl Clone for ValidationVocabulary
impl Clone for ValidationVocabulary
Source§fn clone(&self) -> ValidationVocabulary
fn clone(&self) -> ValidationVocabulary
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ValidationVocabulary
impl Debug for ValidationVocabulary
Source§impl Default for ValidationVocabulary
impl Default for ValidationVocabulary
Source§fn default() -> ValidationVocabulary
fn default() -> ValidationVocabulary
Source§impl<'de> Deserialize<'de> for ValidationVocabulary
impl<'de> Deserialize<'de> for ValidationVocabulary
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for ValidationVocabulary
impl JsonSchema for ValidationVocabulary
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for ValidationVocabulary
impl PartialEq for ValidationVocabulary
Source§impl Serialize for ValidationVocabulary
impl Serialize for ValidationVocabulary
impl Eq for ValidationVocabulary
impl StructuralPartialEq for ValidationVocabulary
Auto Trait Implementations§
impl Freeze for ValidationVocabulary
impl RefUnwindSafe for ValidationVocabulary
impl Send for ValidationVocabulary
impl Sync for ValidationVocabulary
impl Unpin for ValidationVocabulary
impl UnsafeUnpin for ValidationVocabulary
impl UnwindSafe for ValidationVocabulary
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.