Struct ObjectBuilder

Source
pub struct ObjectBuilder<S: State = Empty> { /* private fields */ }
Expand description

Use builder syntax to set the inputs and finish with build().

Implementations§

Source§

impl<S: State> ObjectBuilder<S>

Source

pub fn build(self) -> Object
where S: IsComplete,

Finish building and return the requested object

Source

pub fn id(self, value: impl Into<String>) -> ObjectBuilder<SetId<S>>
where S::Id: IsUnset,

Optional (Some / Option setters). Default: "".

The $id keyword defines a unique identifier for the schema. https://www.learnjsonschema.com/2020-12/meta-data/id/

Source

pub fn maybe_id( self, value: Option<impl Into<String>>, ) -> ObjectBuilder<SetId<S>>
where S::Id: IsUnset,

Optional (Some / Option setters). Default: "".

The $id keyword defines a unique identifier for the schema. https://www.learnjsonschema.com/2020-12/meta-data/id/

Source

pub fn schema(self, value: impl Into<Schema>) -> ObjectBuilder<SetSchema<S>>
where S::Schema: IsUnset,

Optional (Some / Option setters).

The $schema keyword declares the JSON Schema version. https://www.learnjsonschema.com/2020-12/meta-data/schema/

Source

pub fn maybe_schema( self, value: Option<impl Into<Schema>>, ) -> ObjectBuilder<SetSchema<S>>
where S::Schema: IsUnset,

Optional (Some / Option setters).

The $schema keyword declares the JSON Schema version. https://www.learnjsonschema.com/2020-12/meta-data/schema/

Source

pub fn reference( self, value: impl Into<String>, ) -> ObjectBuilder<SetReference<S>>
where S::Reference: IsUnset,

Optional (Some / Option setters). Default: "".

The $ref keyword references an external or internal schema by URI. https://www.learnjsonschema.com/2020-12/structure/$ref/

Source

pub fn maybe_reference( self, value: Option<impl Into<String>>, ) -> ObjectBuilder<SetReference<S>>
where S::Reference: IsUnset,

Optional (Some / Option setters). Default: "".

The $ref keyword references an external or internal schema by URI. https://www.learnjsonschema.com/2020-12/structure/$ref/

Source

pub fn comment(self, value: impl Into<String>) -> ObjectBuilder<SetComment<S>>
where S::Comment: IsUnset,

Optional (Some / Option setters). Default: "".

The $comment keyword provides annotations for documentation. https://www.learnjsonschema.com/2020-12/meta-data/comment/

Source

pub fn maybe_comment( self, value: Option<impl Into<String>>, ) -> ObjectBuilder<SetComment<S>>
where S::Comment: IsUnset,

Optional (Some / Option setters). Default: "".

The $comment keyword provides annotations for documentation. https://www.learnjsonschema.com/2020-12/meta-data/comment/

Source

pub fn title(self, value: impl Into<String>) -> ObjectBuilder<SetTitle<S>>
where S::Title: IsUnset,

Optional (Some / Option setters). Default: "".

The title keyword provides a short descriptive title. https://www.learnjsonschema.com/2020-12/meta-data/title/

Source

pub fn maybe_title( self, value: Option<impl Into<String>>, ) -> ObjectBuilder<SetTitle<S>>
where S::Title: IsUnset,

Optional (Some / Option setters). Default: "".

The title keyword provides a short descriptive title. https://www.learnjsonschema.com/2020-12/meta-data/title/

Source

pub fn description( self, value: impl Into<String>, ) -> ObjectBuilder<SetDescription<S>>
where S::Description: IsUnset,

Optional (Some / Option setters). Default: "".

The description keyword provides a detailed description. https://www.learnjsonschema.com/2020-12/meta-data/description/

Source

pub fn maybe_description( self, value: Option<impl Into<String>>, ) -> ObjectBuilder<SetDescription<S>>
where S::Description: IsUnset,

Optional (Some / Option setters). Default: "".

The description keyword provides a detailed description. https://www.learnjsonschema.com/2020-12/meta-data/description/

Source

pub fn summary(self, value: impl Into<String>) -> ObjectBuilder<SetSummary<S>>
where S::Summary: IsUnset,

Optional (Some / Option setters). Default: "".

The summary keyword offers a brief summary for documentation. https://www.learnjsonschema.com/2020-12/meta-data/summary/

Source

pub fn maybe_summary( self, value: Option<impl Into<String>>, ) -> ObjectBuilder<SetSummary<S>>
where S::Summary: IsUnset,

Optional (Some / Option setters). Default: "".

The summary keyword offers a brief summary for documentation. https://www.learnjsonschema.com/2020-12/meta-data/summary/

Source

pub fn default(self, value: impl Into<Value>) -> ObjectBuilder<SetDefault<S>>
where S::Default: IsUnset,

Optional (Some / Option setters).

The default keyword provides a default instance value. https://www.learnjsonschema.com/2020-12/validation/default/

Source

pub fn maybe_default( self, value: Option<impl Into<Value>>, ) -> ObjectBuilder<SetDefault<S>>
where S::Default: IsUnset,

Optional (Some / Option setters).

The default keyword provides a default instance value. https://www.learnjsonschema.com/2020-12/validation/default/

Source

pub fn read_only(self, value: impl Into<bool>) -> ObjectBuilder<SetReadOnly<S>>
where S::ReadOnly: IsUnset,

Optional (Some / Option setters).

The readOnly keyword marks a property as read-only. https://www.learnjsonschema.com/2020-12/validation/readOnly/

Source

pub fn maybe_read_only( self, value: Option<impl Into<bool>>, ) -> ObjectBuilder<SetReadOnly<S>>
where S::ReadOnly: IsUnset,

Optional (Some / Option setters).

The readOnly keyword marks a property as read-only. https://www.learnjsonschema.com/2020-12/validation/readOnly/

Source

pub fn deprecated( self, value: impl Into<bool>, ) -> ObjectBuilder<SetDeprecated<S>>
where S::Deprecated: IsUnset,

Optional (Some / Option setters).

The deprecated keyword marks a schema as deprecated. https://www.learnjsonschema.com/2020-12/meta-data/deprecated/

Source

pub fn maybe_deprecated( self, value: Option<impl Into<bool>>, ) -> ObjectBuilder<SetDeprecated<S>>
where S::Deprecated: IsUnset,

Optional (Some / Option setters).

The deprecated keyword marks a schema as deprecated. https://www.learnjsonschema.com/2020-12/meta-data/deprecated/

Source

pub fn write_only( self, value: impl Into<bool>, ) -> ObjectBuilder<SetWriteOnly<S>>
where S::WriteOnly: IsUnset,

Optional (Some / Option setters).

The writeOnly keyword marks a property as write-only. https://www.learnjsonschema.com/2020-12/validation/writeOnly/

Source

pub fn maybe_write_only( self, value: Option<impl Into<bool>>, ) -> ObjectBuilder<SetWriteOnly<S>>
where S::WriteOnly: IsUnset,

Optional (Some / Option setters).

The writeOnly keyword marks a property as write-only. https://www.learnjsonschema.com/2020-12/validation/writeOnly/

Source

pub fn multiple_of( self, value: impl Into<OrderedFloat<f64>>, ) -> ObjectBuilder<SetMultipleOf<S>>
where S::MultipleOf: IsUnset,

Optional (Some / Option setters).

The multipleOf keyword ensures the number is a multiple of this value. https://www.learnjsonschema.com/2020-12/validation/multipleOf/

Source

pub fn maybe_multiple_of( self, value: Option<impl Into<OrderedFloat<f64>>>, ) -> ObjectBuilder<SetMultipleOf<S>>
where S::MultipleOf: IsUnset,

Optional (Some / Option setters).

The multipleOf keyword ensures the number is a multiple of this value. https://www.learnjsonschema.com/2020-12/validation/multipleOf/

Source

pub fn maximum( self, value: impl Into<OrderedFloat<f64>>, ) -> ObjectBuilder<SetMaximum<S>>
where S::Maximum: IsUnset,

Optional (Some / Option setters).

The maximum keyword defines the maximum numeric value. https://www.learnjsonschema.com/2020-12/validation/maximum/

Source

pub fn maybe_maximum( self, value: Option<impl Into<OrderedFloat<f64>>>, ) -> ObjectBuilder<SetMaximum<S>>
where S::Maximum: IsUnset,

Optional (Some / Option setters).

The maximum keyword defines the maximum numeric value. https://www.learnjsonschema.com/2020-12/validation/maximum/

Source

pub fn exclusive_maximum( self, value: impl Into<OrderedFloat<f64>>, ) -> ObjectBuilder<SetExclusiveMaximum<S>>
where S::ExclusiveMaximum: IsUnset,

Optional (Some / Option setters).

The exclusiveMaximum keyword requires the number to be less than this value. https://www.learnjsonschema.com/2020-12/validation/exclusiveMaximum/

Source

pub fn maybe_exclusive_maximum( self, value: Option<impl Into<OrderedFloat<f64>>>, ) -> ObjectBuilder<SetExclusiveMaximum<S>>
where S::ExclusiveMaximum: IsUnset,

Optional (Some / Option setters).

The exclusiveMaximum keyword requires the number to be less than this value. https://www.learnjsonschema.com/2020-12/validation/exclusiveMaximum/

Source

pub fn minimum( self, value: impl Into<OrderedFloat<f64>>, ) -> ObjectBuilder<SetMinimum<S>>
where S::Minimum: IsUnset,

Optional (Some / Option setters).

The minimum keyword defines the minimum numeric value. https://www.learnjsonschema.com/2020-12/validation/minimum/

Source

pub fn maybe_minimum( self, value: Option<impl Into<OrderedFloat<f64>>>, ) -> ObjectBuilder<SetMinimum<S>>
where S::Minimum: IsUnset,

Optional (Some / Option setters).

The minimum keyword defines the minimum numeric value. https://www.learnjsonschema.com/2020-12/validation/minimum/

Source

pub fn exclusive_minimum( self, value: impl Into<OrderedFloat<f64>>, ) -> ObjectBuilder<SetExclusiveMinimum<S>>
where S::ExclusiveMinimum: IsUnset,

Optional (Some / Option setters).

The exclusiveMinimum keyword requires the number to be greater than this value. https://www.learnjsonschema.com/2020-12/validation/exclusiveMinimum/

Source

pub fn maybe_exclusive_minimum( self, value: Option<impl Into<OrderedFloat<f64>>>, ) -> ObjectBuilder<SetExclusiveMinimum<S>>
where S::ExclusiveMinimum: IsUnset,

Optional (Some / Option setters).

The exclusiveMinimum keyword requires the number to be greater than this value. https://www.learnjsonschema.com/2020-12/validation/exclusiveMinimum/

Source

pub fn max_length(self, value: impl Into<u64>) -> ObjectBuilder<SetMaxLength<S>>
where S::MaxLength: IsUnset,

Optional (Some / Option setters).

The maxLength keyword restricts string length to at most this value. https://www.learnjsonschema.com/2020-12/validation/maxLength/

Source

pub fn maybe_max_length( self, value: Option<impl Into<u64>>, ) -> ObjectBuilder<SetMaxLength<S>>
where S::MaxLength: IsUnset,

Optional (Some / Option setters).

The maxLength keyword restricts string length to at most this value. https://www.learnjsonschema.com/2020-12/validation/maxLength/

Source

pub fn min_length(self, value: impl Into<u64>) -> ObjectBuilder<SetMinLength<S>>
where S::MinLength: IsUnset,

Optional (Some / Option setters).

The minLength keyword restricts string length to at least this value. https://www.learnjsonschema.com/2020-12/validation/minLength/

Source

pub fn maybe_min_length( self, value: Option<impl Into<u64>>, ) -> ObjectBuilder<SetMinLength<S>>
where S::MinLength: IsUnset,

Optional (Some / Option setters).

The minLength keyword restricts string length to at least this value. https://www.learnjsonschema.com/2020-12/validation/minLength/

Source

pub fn pattern(self, value: impl Into<String>) -> ObjectBuilder<SetPattern<S>>
where S::Pattern: IsUnset,

Optional (Some / Option setters).

The pattern keyword restricts strings to those matching this regular expression. https://www.learnjsonschema.com/2020-12/validation/pattern/

Source

pub fn maybe_pattern( self, value: Option<impl Into<String>>, ) -> ObjectBuilder<SetPattern<S>>
where S::Pattern: IsUnset,

Optional (Some / Option setters).

The pattern keyword restricts strings to those matching this regular expression. https://www.learnjsonschema.com/2020-12/validation/pattern/

Source

pub fn additional_items( self, value: impl Into<Schema>, ) -> ObjectBuilder<SetAdditionalItems<S>>
where S::AdditionalItems: IsUnset,

Optional (Some / Option setters).

The additionalItems keyword defines the schema for array elements beyond those covered by a tuple definition. https://www.learnjsonschema.com/2020-12/applicator/additionalItems/

Source

pub fn maybe_additional_items( self, value: Option<impl Into<Schema>>, ) -> ObjectBuilder<SetAdditionalItems<S>>
where S::AdditionalItems: IsUnset,

Optional (Some / Option setters).

The additionalItems keyword defines the schema for array elements beyond those covered by a tuple definition. https://www.learnjsonschema.com/2020-12/applicator/additionalItems/

Source

pub fn items(self, value: impl Into<Schema>) -> ObjectBuilder<SetItems<S>>
where S::Items: IsUnset,

Optional (Some / Option setters).

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/

Source

pub fn maybe_items( self, value: Option<impl Into<Schema>>, ) -> ObjectBuilder<SetItems<S>>
where S::Items: IsUnset,

Optional (Some / Option setters).

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/

Source

pub fn max_items(self, value: impl Into<u64>) -> ObjectBuilder<SetMaxItems<S>>
where S::MaxItems: IsUnset,

Optional (Some / Option setters).

The maxItems keyword restricts the number of elements in an array to at most this value. https://www.learnjsonschema.com/2020-12/validation/maxItems/

Source

pub fn maybe_max_items( self, value: Option<impl Into<u64>>, ) -> ObjectBuilder<SetMaxItems<S>>
where S::MaxItems: IsUnset,

Optional (Some / Option setters).

The maxItems keyword restricts the number of elements in an array to at most this value. https://www.learnjsonschema.com/2020-12/validation/maxItems/

Source

pub fn min_items(self, value: impl Into<u64>) -> ObjectBuilder<SetMinItems<S>>
where S::MinItems: IsUnset,

Optional (Some / Option setters).

The minItems keyword restricts the number of elements in an array to at least this value. https://www.learnjsonschema.com/2020-12/validation/minItems/

Source

pub fn maybe_min_items( self, value: Option<impl Into<u64>>, ) -> ObjectBuilder<SetMinItems<S>>
where S::MinItems: IsUnset,

Optional (Some / Option setters).

The minItems keyword restricts the number of elements in an array to at least this value. https://www.learnjsonschema.com/2020-12/validation/minItems/

Source

pub fn unique_items( self, value: impl Into<bool>, ) -> ObjectBuilder<SetUniqueItems<S>>
where S::UniqueItems: IsUnset,

Optional (Some / Option setters).

The uniqueItems keyword ensures that all elements in an array are unique. https://www.learnjsonschema.com/2020-12/validation/uniqueItems/

Source

pub fn maybe_unique_items( self, value: Option<impl Into<bool>>, ) -> ObjectBuilder<SetUniqueItems<S>>
where S::UniqueItems: IsUnset,

Optional (Some / Option setters).

The uniqueItems keyword ensures that all elements in an array are unique. https://www.learnjsonschema.com/2020-12/validation/uniqueItems/

Source

pub fn contains(self, value: impl Into<Schema>) -> ObjectBuilder<SetContains<S>>
where S::Contains: IsUnset,

Optional (Some / Option setters).

The contains keyword ensures that at least one element in the array matches the specified schema. https://www.learnjsonschema.com/2020-12/applicator/contains/

Source

pub fn maybe_contains( self, value: Option<impl Into<Schema>>, ) -> ObjectBuilder<SetContains<S>>
where S::Contains: IsUnset,

Optional (Some / Option setters).

The contains keyword ensures that at least one element in the array matches the specified schema. https://www.learnjsonschema.com/2020-12/applicator/contains/

Source

pub fn max_properties( self, value: impl Into<u64>, ) -> ObjectBuilder<SetMaxProperties<S>>
where S::MaxProperties: IsUnset,

Optional (Some / Option setters).

The maxProperties keyword restricts the number of properties in an object to at most this value. https://www.learnjsonschema.com/2020-12/validation/maxProperties/

Source

pub fn maybe_max_properties( self, value: Option<impl Into<u64>>, ) -> ObjectBuilder<SetMaxProperties<S>>
where S::MaxProperties: IsUnset,

Optional (Some / Option setters).

The maxProperties keyword restricts the number of properties in an object to at most this value. https://www.learnjsonschema.com/2020-12/validation/maxProperties/

Source

pub fn min_properties( self, value: impl Into<u64>, ) -> ObjectBuilder<SetMinProperties<S>>
where S::MinProperties: IsUnset,

Optional (Some / Option setters).

The minProperties keyword restricts the number of properties in an object to at least this value. https://www.learnjsonschema.com/2020-12/validation/minProperties/

Source

pub fn maybe_min_properties( self, value: Option<impl Into<u64>>, ) -> ObjectBuilder<SetMinProperties<S>>
where S::MinProperties: IsUnset,

Optional (Some / Option setters).

The minProperties keyword restricts the number of properties in an object to at least this value. https://www.learnjsonschema.com/2020-12/validation/minProperties/

Source

pub fn max_contains( self, value: impl Into<u64>, ) -> ObjectBuilder<SetMaxContains<S>>
where S::MaxContains: IsUnset,

Optional (Some / Option setters).

The maxContains keyword limits how many items matching contains may appear in an array. https://www.learnjsonschema.com/2020-12/applicator/maxContains/

Source

pub fn maybe_max_contains( self, value: Option<impl Into<u64>>, ) -> ObjectBuilder<SetMaxContains<S>>
where S::MaxContains: IsUnset,

Optional (Some / Option setters).

The maxContains keyword limits how many items matching contains may appear in an array. https://www.learnjsonschema.com/2020-12/applicator/maxContains/

Source

pub fn min_contains( self, value: impl Into<u64>, ) -> ObjectBuilder<SetMinContains<S>>
where S::MinContains: IsUnset,

Optional (Some / Option setters).

The minContains keyword requires at least this many items matching contains in an array. https://www.learnjsonschema.com/2020-12/applicator/minContains/

Source

pub fn maybe_min_contains( self, value: Option<impl Into<u64>>, ) -> ObjectBuilder<SetMinContains<S>>
where S::MinContains: IsUnset,

Optional (Some / Option setters).

The minContains keyword requires at least this many items matching contains in an array. https://www.learnjsonschema.com/2020-12/applicator/minContains/

Source

pub fn additional_properties( self, value: impl Into<Schema>, ) -> ObjectBuilder<SetAdditionalProperties<S>>
where S::AdditionalProperties: IsUnset,

Optional (Some / Option setters).

The additionalProperties keyword defines the schema for object properties not explicitly listed. https://www.learnjsonschema.com/2020-12/applicator/additionalProperties/

Source

pub fn maybe_additional_properties( self, value: Option<impl Into<Schema>>, ) -> ObjectBuilder<SetAdditionalProperties<S>>
where S::AdditionalProperties: IsUnset,

Optional (Some / Option setters).

The additionalProperties keyword defines the schema for object properties not explicitly listed. https://www.learnjsonschema.com/2020-12/applicator/additionalProperties/

Source

pub fn definitions( self, value: impl Into<IndexMap<String, Schema>>, ) -> ObjectBuilder<SetDefinitions<S>>
where S::Definitions: IsUnset,

Optional (Some / Option setters). Default: <IndexMap<String, Schema> as Default>::default().

The definitions section holds reusable schema definitions for reference. https://www.learnjsonschema.com/2020-12/meta-data/definitions/

Source

pub fn maybe_definitions( self, value: Option<impl Into<IndexMap<String, Schema>>>, ) -> ObjectBuilder<SetDefinitions<S>>
where S::Definitions: IsUnset,

Optional (Some / Option setters). Default: <IndexMap<String, Schema> as Default>::default().

The definitions section holds reusable schema definitions for reference. https://www.learnjsonschema.com/2020-12/meta-data/definitions/

Source

pub fn pattern_properties( self, value: impl Into<IndexMap<String, Schema>>, ) -> ObjectBuilder<SetPatternProperties<S>>
where S::PatternProperties: IsUnset,

Optional (Some / Option setters). Default: <IndexMap<String, Schema> as Default>::default().

The patternProperties keyword maps regex patterns to schemas for matching property names. https://www.learnjsonschema.com/2020-12/applicator/patternProperties/

Source

pub fn maybe_pattern_properties( self, value: Option<impl Into<IndexMap<String, Schema>>>, ) -> ObjectBuilder<SetPatternProperties<S>>
where S::PatternProperties: IsUnset,

Optional (Some / Option setters). Default: <IndexMap<String, Schema> as Default>::default().

The patternProperties keyword maps regex patterns to schemas for matching property names. https://www.learnjsonschema.com/2020-12/applicator/patternProperties/

Source

pub fn dependencies( self, value: impl Into<IndexMap<String, Schema>>, ) -> ObjectBuilder<SetDependencies<S>>
where S::Dependencies: IsUnset,

Optional (Some / Option setters). Default: <IndexMap<String, Schema> as Default>::default().

The dependencies keyword specifies schema or property dependencies for an object. https://www.learnjsonschema.com/2020-12/applicator/dependencies/

Source

pub fn maybe_dependencies( self, value: Option<impl Into<IndexMap<String, Schema>>>, ) -> ObjectBuilder<SetDependencies<S>>
where S::Dependencies: IsUnset,

Optional (Some / Option setters). Default: <IndexMap<String, Schema> as Default>::default().

The dependencies keyword specifies schema or property dependencies for an object. https://www.learnjsonschema.com/2020-12/applicator/dependencies/

Source

pub fn property_names( self, value: impl Into<Schema>, ) -> ObjectBuilder<SetPropertyNames<S>>
where S::PropertyNames: IsUnset,

Optional (Some / Option setters).

The propertyNames keyword restricts all property names in an object to match this schema. https://www.learnjsonschema.com/2020-12/applicator/propertyNames/

Source

pub fn maybe_property_names( self, value: Option<impl Into<Schema>>, ) -> ObjectBuilder<SetPropertyNames<S>>
where S::PropertyNames: IsUnset,

Optional (Some / Option setters).

The propertyNames keyword restricts all property names in an object to match this schema. https://www.learnjsonschema.com/2020-12/applicator/propertyNames/

Source

pub fn const_value( self, value: impl Into<Value>, ) -> ObjectBuilder<SetConstValue<S>>
where S::ConstValue: IsUnset,

Optional (Some / Option setters).

The const keyword requires the instance to be exactly this value. https://www.learnjsonschema.com/2020-12/validation/const/

Source

pub fn maybe_const_value( self, value: Option<impl Into<Value>>, ) -> ObjectBuilder<SetConstValue<S>>
where S::ConstValue: IsUnset,

Optional (Some / Option setters).

The const keyword requires the instance to be exactly this value. https://www.learnjsonschema.com/2020-12/validation/const/

Source

pub fn schema_type( self, value: impl Into<Types>, ) -> ObjectBuilder<SetSchemaType<S>>
where S::SchemaType: IsUnset,

Optional (Some / Option setters).

The type keyword restricts the instance to the specified JSON types. https://www.learnjsonschema.com/2020-12/validation/type/

Source

pub fn maybe_schema_type( self, value: Option<impl Into<Types>>, ) -> ObjectBuilder<SetSchemaType<S>>
where S::SchemaType: IsUnset,

Optional (Some / Option setters).

The type keyword restricts the instance to the specified JSON types. https://www.learnjsonschema.com/2020-12/validation/type/

Source

pub fn format(self, value: impl Into<String>) -> ObjectBuilder<SetFormat<S>>
where S::Format: IsUnset,

Optional (Some / Option setters). Default: "".

The format keyword provides semantic validation hints, such as “email” or “date-time”. https://www.learnjsonschema.com/2020-12/meta-data/format/

Source

pub fn maybe_format( self, value: Option<impl Into<String>>, ) -> ObjectBuilder<SetFormat<S>>
where S::Format: IsUnset,

Optional (Some / Option setters). Default: "".

The format keyword provides semantic validation hints, such as “email” or “date-time”. https://www.learnjsonschema.com/2020-12/meta-data/format/

Source

pub fn content_media_type( self, value: impl Into<String>, ) -> ObjectBuilder<SetContentMediaType<S>>
where S::ContentMediaType: IsUnset,

Optional (Some / Option setters). Default: "".

The contentMediaType annotation describes the media type for string content. https://www.learnjsonschema.com/2020-12/annotations/contentMediaType/

Source

pub fn maybe_content_media_type( self, value: Option<impl Into<String>>, ) -> ObjectBuilder<SetContentMediaType<S>>
where S::ContentMediaType: IsUnset,

Optional (Some / Option setters). Default: "".

The contentMediaType annotation describes the media type for string content. https://www.learnjsonschema.com/2020-12/annotations/contentMediaType/

Source

pub fn content_encoding( self, value: impl Into<String>, ) -> ObjectBuilder<SetContentEncoding<S>>
where S::ContentEncoding: IsUnset,

Optional (Some / Option setters). Default: "".

The contentEncoding annotation describes the encoding (e.g., “base64”) for string content. https://www.learnjsonschema.com/2020-12/annotations/contentEncoding/

Source

pub fn maybe_content_encoding( self, value: Option<impl Into<String>>, ) -> ObjectBuilder<SetContentEncoding<S>>
where S::ContentEncoding: IsUnset,

Optional (Some / Option setters). Default: "".

The contentEncoding annotation describes the encoding (e.g., “base64”) for string content. https://www.learnjsonschema.com/2020-12/annotations/contentEncoding/

Source

pub fn content_schema( self, value: impl Into<Schema>, ) -> ObjectBuilder<SetContentSchema<S>>
where S::ContentSchema: IsUnset,

Optional (Some / Option setters).

The contentSchema annotation defines a schema for binary media represented as a string. https://www.learnjsonschema.com/2020-12/applicator/contentSchema/

Source

pub fn maybe_content_schema( self, value: Option<impl Into<Schema>>, ) -> ObjectBuilder<SetContentSchema<S>>
where S::ContentSchema: IsUnset,

Optional (Some / Option setters).

The contentSchema annotation defines a schema for binary media represented as a string. https://www.learnjsonschema.com/2020-12/applicator/contentSchema/

Source

pub fn if_cond(self, value: impl Into<Schema>) -> ObjectBuilder<SetIfCond<S>>
where S::IfCond: IsUnset,

Optional (Some / Option setters).

The if keyword applies conditional schema validation when this subschema is valid. https://www.learnjsonschema.com/2020-12/applicator/if/

Source

pub fn maybe_if_cond( self, value: Option<impl Into<Schema>>, ) -> ObjectBuilder<SetIfCond<S>>
where S::IfCond: IsUnset,

Optional (Some / Option setters).

The if keyword applies conditional schema validation when this subschema is valid. https://www.learnjsonschema.com/2020-12/applicator/if/

Source

pub fn then_cond( self, value: impl Into<Schema>, ) -> ObjectBuilder<SetThenCond<S>>
where S::ThenCond: IsUnset,

Optional (Some / Option setters).

The then keyword applies this subschema when the if condition is met. https://www.learnjsonschema.com/2020-12/applicator/then/

Source

pub fn maybe_then_cond( self, value: Option<impl Into<Schema>>, ) -> ObjectBuilder<SetThenCond<S>>
where S::ThenCond: IsUnset,

Optional (Some / Option setters).

The then keyword applies this subschema when the if condition is met. https://www.learnjsonschema.com/2020-12/applicator/then/

Source

pub fn else_cond( self, value: impl Into<Schema>, ) -> ObjectBuilder<SetElseCond<S>>
where S::ElseCond: IsUnset,

Optional (Some / Option setters).

The else keyword applies this subschema when the if condition is not met. https://www.learnjsonschema.com/2020-12/applicator/else/

Source

pub fn maybe_else_cond( self, value: Option<impl Into<Schema>>, ) -> ObjectBuilder<SetElseCond<S>>
where S::ElseCond: IsUnset,

Optional (Some / Option setters).

The else keyword applies this subschema when the if condition is not met. https://www.learnjsonschema.com/2020-12/applicator/else/

Source

pub fn not(self, value: impl Into<Schema>) -> ObjectBuilder<SetNot<S>>
where S::Not: IsUnset,

Optional (Some / Option setters).

The not keyword ensures the instance does not match this subschema. https://www.learnjsonschema.com/2020-12/applicator/not/

Source

pub fn maybe_not( self, value: Option<impl Into<Schema>>, ) -> ObjectBuilder<SetNot<S>>
where S::Not: IsUnset,

Optional (Some / Option setters).

The not keyword ensures the instance does not match this subschema. https://www.learnjsonschema.com/2020-12/applicator/not/

Source

pub fn unevaluated_items( self, value: impl Into<Schema>, ) -> ObjectBuilder<SetUnevaluatedItems<S>>
where S::UnevaluatedItems: IsUnset,

Optional (Some / Option setters).

The unevaluatedItems keyword applies schemas to items not covered by items or contains. https://www.learnjsonschema.com/2020-12/applicator/unevaluatedItems/

Source

pub fn maybe_unevaluated_items( self, value: Option<impl Into<Schema>>, ) -> ObjectBuilder<SetUnevaluatedItems<S>>
where S::UnevaluatedItems: IsUnset,

Optional (Some / Option setters).

The unevaluatedItems keyword applies schemas to items not covered by items or contains. https://www.learnjsonschema.com/2020-12/applicator/unevaluatedItems/

Source

pub fn unevaluated_properties( self, value: impl Into<Schema>, ) -> ObjectBuilder<SetUnevaluatedProperties<S>>
where S::UnevaluatedProperties: IsUnset,

Optional (Some / Option setters).

The unevaluatedProperties keyword applies schemas to properties not covered by properties or pattern-based keywords. https://www.learnjsonschema.com/2020-12/applicator/unevaluatedProperties/

Source

pub fn maybe_unevaluated_properties( self, value: Option<impl Into<Schema>>, ) -> ObjectBuilder<SetUnevaluatedProperties<S>>
where S::UnevaluatedProperties: IsUnset,

Optional (Some / Option setters).

The unevaluatedProperties keyword applies schemas to properties not covered by properties or pattern-based keywords. https://www.learnjsonschema.com/2020-12/applicator/unevaluatedProperties/

Source

pub fn discriminator( self, value: impl Into<Discriminator>, ) -> ObjectBuilder<SetDiscriminator<S>>
where S::Discriminator: IsUnset,

Optional (Some / Option setters).

The discriminator keyword provides object property-based type differentiation (OpenAPI). https://spec.openapis.org/oas/v3.1.0#discriminator-object

Source

pub fn maybe_discriminator( self, value: Option<impl Into<Discriminator>>, ) -> ObjectBuilder<SetDiscriminator<S>>
where S::Discriminator: IsUnset,

Optional (Some / Option setters).

The discriminator keyword provides object property-based type differentiation (OpenAPI). https://spec.openapis.org/oas/v3.1.0#discriminator-object

Source

pub fn extensions( self, value: impl Into<Extensions>, ) -> ObjectBuilder<SetExtensions<S>>
where S::Extensions: IsUnset,

Optional (Some / Option setters).

All additional, unrecognized fields are stored here as extensions.

Source

pub fn maybe_extensions( self, value: Option<impl Into<Extensions>>, ) -> ObjectBuilder<SetExtensions<S>>
where S::Extensions: IsUnset,

Optional (Some / Option setters).

All additional, unrecognized fields are stored here as extensions.

Source§

impl<S: State> ObjectBuilder<S>

Source

pub fn properties<P: Into<String>, C: Into<Schema>>( self, properties: impl IntoIterator<Item = (P, C)>, ) -> Self

Extend the properties using the iterator of (name, schema)

Source

pub fn property( self, name: impl Into<String>, schema: impl Into<Schema>, ) -> Self

Add a singular property

Source

pub fn all_of(self, all_of: impl Into<Schema>) -> Self

Add a singular schema into the allOf array

Source

pub fn all_ofs<C: Into<Schema>>( self, all_ofs: impl IntoIterator<Item = C>, ) -> Self

Extend the allOf array using the iterator of schemas

Source

pub fn any_ofs<C: Into<Schema>>( self, any_ofs: impl IntoIterator<Item = C>, ) -> Self

Extend the anyOf array using the iterator of schemas

Source

pub fn any_of(self, any_of: impl Into<Schema>) -> Self

Add a singular schema into the anyOf array

Source

pub fn one_ofs<C: Into<Schema>>( self, one_ofs: impl IntoIterator<Item = C>, ) -> Self

Extend the oneOfs array using the iterator of schemas

Source

pub fn one_of(self, one_of: impl Into<Schema>) -> Self

Add a singular schema into the oneOf array

Source

pub fn enum_value(self, enum_value: impl Into<Value>) -> Self

Add a singular item into the enum array

Source

pub fn enum_values<E: Into<Value>>( self, enum_values: impl IntoIterator<Item = E>, ) -> Self

Extend the enum array using an iterator of items

Source

pub fn require(self, require: impl Into<String>) -> Self

Add a single field into the required array

Source

pub fn required<R: Into<String>>( self, required: impl IntoIterator<Item = R>, ) -> Self

Extend the required array from the iterator of fields.

Source

pub fn example(self, example: impl Into<Value>) -> Self

Add a single example to the examples array

Source

pub fn examples<E: Into<Value>>( self, examples: impl IntoIterator<Item = E>, ) -> Self

Extend the examples array using an iterator of examples.

Source§

impl<S: IsComplete> ObjectBuilder<S>

Source

pub fn to_array(self) -> ObjectBuilder<SetItems<SetSchemaType>>

Convert the object into an array of this type

Trait Implementations§

Source§

impl<S: IsComplete> From<ObjectBuilder<S>> for Object

Source§

fn from(value: ObjectBuilder<S>) -> Self

Converts to this type from the input type.
Source§

impl<S: IsComplete> From<ObjectBuilder<S>> for Schema

Source§

fn from(value: ObjectBuilder<S>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<S> Freeze for ObjectBuilder<S>

§

impl<S> RefUnwindSafe for ObjectBuilder<S>

§

impl<S> Send for ObjectBuilder<S>

§

impl<S> Sync for ObjectBuilder<S>

§

impl<S> Unpin for ObjectBuilder<S>

§

impl<S> UnwindSafe for ObjectBuilder<S>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.