#[non_exhaustive]pub struct Object {Show 56 fields
pub properties: IndexMap<String, Schema>,
pub examples: Vec<Value>,
pub prefix_items: Option<Vec<Schema>>,
pub enum_values: Option<Vec<Value>>,
pub required: Vec<String>,
pub all_of: Vec<Schema>,
pub any_of: Option<Vec<Schema>>,
pub one_of: Option<Vec<Schema>>,
pub id: String,
pub schema: Option<Schema>,
pub reference: String,
pub comment: String,
pub title: String,
pub description: String,
pub summary: String,
pub default: Option<Value>,
pub read_only: Option<bool>,
pub deprecated: Option<bool>,
pub write_only: Option<bool>,
pub multiple_of: Option<OrderedFloat<f64>>,
pub maximum: Option<OrderedFloat<f64>>,
pub exclusive_maximum: Option<OrderedFloat<f64>>,
pub minimum: Option<OrderedFloat<f64>>,
pub exclusive_minimum: Option<OrderedFloat<f64>>,
pub max_length: Option<u64>,
pub min_length: Option<u64>,
pub pattern: Option<String>,
pub additional_items: Option<Schema>,
pub items: Option<Schema>,
pub max_items: Option<u64>,
pub min_items: Option<u64>,
pub unique_items: Option<bool>,
pub contains: Option<Schema>,
pub max_properties: Option<u64>,
pub min_properties: Option<u64>,
pub max_contains: Option<u64>,
pub min_contains: Option<u64>,
pub additional_properties: Option<Schema>,
pub definitions: IndexMap<String, Schema>,
pub pattern_properties: IndexMap<String, Schema>,
pub dependencies: IndexMap<String, Schema>,
pub property_names: Option<Schema>,
pub const_value: Option<Value>,
pub schema_type: Option<Types>,
pub format: String,
pub content_media_type: String,
pub content_encoding: String,
pub content_schema: Option<Schema>,
pub if_cond: Option<Schema>,
pub then: Option<Schema>,
pub else_cond: Option<Schema>,
pub not: Option<Schema>,
pub unevaluated_items: Option<Schema>,
pub unevaluated_properties: Option<Schema>,
pub discriminator: Option<Discriminator>,
pub extensions: Option<Extensions>,
}
Expand description
A JSON Schema Object as per JSON Schema specification. https://www.learnjsonschema.com/2020-12/
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.properties: IndexMap<String, Schema>
The properties
keyword restricts object properties to the given subschemas.
Collected annotations report which properties were evaluated.
https://www.learnjsonschema.com/2020-12/applicator/properties/
examples: Vec<Value>
The examples
keyword provides example instances for documentation.
Does not affect validation.
https://www.learnjsonschema.com/2020-12/meta-data/examples/
prefix_items: Option<Vec<Schema>>
The prefixItems
keyword validates the first items of an array against a sequence of subschemas.
Remaining items fall back to items
, if present.
https://www.learnjsonschema.com/2020-12/applicator/prefixitems/
enum_values: Option<Vec<Value>>
The enum
keyword restricts instances to a finite set of values.
https://www.learnjsonschema.com/2020-12/validation/enum/
required: Vec<String>
The required
keyword lists property names that must be present in an object.
https://www.learnjsonschema.com/2020-12/applicator/required/
all_of: Vec<Schema>
The allOf
keyword requires instance validation against all subschemas.
https://www.learnjsonschema.com/2020-12/validation/allof/
any_of: Option<Vec<Schema>>
The anyOf
keyword requires validation against at least one subschema.
https://www.learnjsonschema.com/2020-12/validation/anyof/
one_of: Option<Vec<Schema>>
The oneOf
keyword requires validation against exactly one subschema.
https://www.learnjsonschema.com/2020-12/validation/oneof/
id: String
The $id
keyword defines a unique identifier for the schema.
https://www.learnjsonschema.com/2020-12/meta-data/id/
schema: Option<Schema>
The $schema
keyword declares the JSON Schema version.
https://www.learnjsonschema.com/2020-12/meta-data/schema/
reference: String
The $ref
keyword references an external or internal schema by URI.
https://www.learnjsonschema.com/2020-12/structure/$ref/
comment: String
The $comment
keyword provides annotations for documentation.
https://www.learnjsonschema.com/2020-12/meta-data/comment/
title: String
The title
keyword provides a short descriptive title.
https://www.learnjsonschema.com/2020-12/meta-data/title/
description: String
The description
keyword provides a detailed description.
https://www.learnjsonschema.com/2020-12/meta-data/description/
summary: String
The summary
keyword offers a brief summary for documentation.
https://www.learnjsonschema.com/2020-12/meta-data/summary/
default: Option<Value>
The default
keyword provides a default instance value.
https://www.learnjsonschema.com/2020-12/validation/default/
read_only: Option<bool>
The readOnly
keyword marks a property as read-only.
https://www.learnjsonschema.com/2020-12/validation/readOnly/
deprecated: Option<bool>
The deprecated
keyword marks a schema as deprecated.
https://www.learnjsonschema.com/2020-12/meta-data/deprecated/
write_only: Option<bool>
The writeOnly
keyword marks a property as write-only.
https://www.learnjsonschema.com/2020-12/validation/writeOnly/
multiple_of: Option<OrderedFloat<f64>>
The multipleOf
keyword ensures the number is a multiple of this value.
https://www.learnjsonschema.com/2020-12/validation/multipleOf/
maximum: Option<OrderedFloat<f64>>
The maximum
keyword defines the maximum numeric value.
https://www.learnjsonschema.com/2020-12/validation/maximum/
exclusive_maximum: Option<OrderedFloat<f64>>
The exclusiveMaximum
keyword requires the number to be less than this value.
https://www.learnjsonschema.com/2020-12/validation/exclusiveMaximum/
minimum: Option<OrderedFloat<f64>>
The minimum
keyword defines the minimum numeric value.
https://www.learnjsonschema.com/2020-12/validation/minimum/
exclusive_minimum: Option<OrderedFloat<f64>>
The exclusiveMinimum
keyword requires the number to be greater than this value.
https://www.learnjsonschema.com/2020-12/validation/exclusiveMinimum/
max_length: Option<u64>
The maxLength
keyword restricts string length to at most this value.
https://www.learnjsonschema.com/2020-12/validation/maxLength/
min_length: Option<u64>
The minLength
keyword restricts string length to at least this value.
https://www.learnjsonschema.com/2020-12/validation/minLength/
pattern: Option<String>
The pattern
keyword restricts strings to those matching this regular expression.
https://www.learnjsonschema.com/2020-12/validation/pattern/
additional_items: Option<Schema>
The additionalItems
keyword defines the schema for array elements beyond those covered by a tuple definition.
https://www.learnjsonschema.com/2020-12/applicator/additionalItems/
items: Option<Schema>
The items
keyword restricts all elements in an array to this schema, or provides a tuple of schemas for positional validation.
https://www.learnjsonschema.com/2020-12/applicator/items/
max_items: Option<u64>
The maxItems
keyword restricts the number of elements in an array to at most this value.
https://www.learnjsonschema.com/2020-12/validation/maxItems/
min_items: Option<u64>
The minItems
keyword restricts the number of elements in an array to at least this value.
https://www.learnjsonschema.com/2020-12/validation/minItems/
unique_items: Option<bool>
The uniqueItems
keyword ensures that all elements in an array are unique.
https://www.learnjsonschema.com/2020-12/validation/uniqueItems/
contains: Option<Schema>
The contains
keyword ensures that at least one element in the array matches the specified schema.
https://www.learnjsonschema.com/2020-12/applicator/contains/
max_properties: Option<u64>
The maxProperties
keyword restricts the number of properties in an object to at most this value.
https://www.learnjsonschema.com/2020-12/validation/maxProperties/
min_properties: Option<u64>
The minProperties
keyword restricts the number of properties in an object to at least this value.
https://www.learnjsonschema.com/2020-12/validation/minProperties/
max_contains: Option<u64>
The maxContains
keyword limits how many items matching contains
may appear in an array.
https://www.learnjsonschema.com/2020-12/applicator/maxContains/
min_contains: Option<u64>
The minContains
keyword requires at least this many items matching contains
in an array.
https://www.learnjsonschema.com/2020-12/applicator/minContains/
additional_properties: Option<Schema>
The additionalProperties
keyword defines the schema for object properties not explicitly listed.
https://www.learnjsonschema.com/2020-12/applicator/additionalProperties/
definitions: IndexMap<String, Schema>
The definitions
section holds reusable schema definitions for reference.
https://www.learnjsonschema.com/2020-12/meta-data/definitions/
pattern_properties: IndexMap<String, Schema>
The patternProperties
keyword maps regex patterns to schemas for matching property names.
https://www.learnjsonschema.com/2020-12/applicator/patternProperties/
dependencies: IndexMap<String, Schema>
The dependencies
keyword specifies schema or property dependencies for an object.
https://www.learnjsonschema.com/2020-12/applicator/dependencies/
property_names: Option<Schema>
The propertyNames
keyword restricts all property names in an object to match this schema.
https://www.learnjsonschema.com/2020-12/applicator/propertyNames/
const_value: Option<Value>
The const
keyword requires the instance to be exactly this value.
https://www.learnjsonschema.com/2020-12/validation/const/
schema_type: Option<Types>
The type
keyword restricts the instance to the specified JSON types.
https://www.learnjsonschema.com/2020-12/validation/type/
format: String
The format
keyword provides semantic validation hints, such as “email” or “date-time”.
https://www.learnjsonschema.com/2020-12/meta-data/format/
content_media_type: String
The contentMediaType
annotation describes the media type for string content.
https://www.learnjsonschema.com/2020-12/annotations/contentMediaType/
content_encoding: String
The contentEncoding
annotation describes the encoding (e.g., “base64”) for string content.
https://www.learnjsonschema.com/2020-12/annotations/contentEncoding/
content_schema: Option<Schema>
The contentSchema
annotation defines a schema for binary media represented as a string.
https://www.learnjsonschema.com/2020-12/applicator/contentSchema/
if_cond: Option<Schema>
The if
keyword applies conditional schema validation when this subschema is valid.
https://www.learnjsonschema.com/2020-12/applicator/if/
then: Option<Schema>
The then
keyword applies this subschema when the if
condition is met.
https://www.learnjsonschema.com/2020-12/applicator/then/
else_cond: Option<Schema>
The else
keyword applies this subschema when the if
condition is not met.
https://www.learnjsonschema.com/2020-12/applicator/else/
not: Option<Schema>
The not
keyword ensures the instance does not match this subschema.
https://www.learnjsonschema.com/2020-12/applicator/not/
unevaluated_items: Option<Schema>
The unevaluatedItems
keyword applies schemas to items not covered by items
or contains
.
https://www.learnjsonschema.com/2020-12/applicator/unevaluatedItems/
unevaluated_properties: Option<Schema>
The unevaluatedProperties
keyword applies schemas to properties not covered by properties
or pattern-based keywords.
https://www.learnjsonschema.com/2020-12/applicator/unevaluatedProperties/
discriminator: Option<Discriminator>
The discriminator
keyword provides object property-based type differentiation (OpenAPI).
https://spec.openapis.org/oas/v3.1.0#discriminator-object
extensions: Option<Extensions>
All additional, unrecognized fields are stored here as extensions.
Implementations§
Source§impl Object
impl Object
Sourcepub fn builder() -> ObjectBuilder
pub fn builder() -> ObjectBuilder
Create an instance of Object
using the builder syntax
Source§impl Object
impl Object
Sourcepub fn with_type(ty: impl Into<Types>) -> ObjectBuilder<SetSchemaType>
pub fn with_type(ty: impl Into<Types>) -> ObjectBuilder<SetSchemaType>
Create a new object builder with the schema type. Short hand for
Object::builder().schema_type(ty)