Class JsonSchema<SELF extends JsonSchema<SELF>>

java.lang.Object
org.apache.juneau.bean.jsonschema.JsonSchema<SELF>
Type Parameters:
SELF - The self type for fluent setters.
Direct Known Subclasses:
JsonSchemaProperty, JsonSchemaRef

@Marshalled(typeName="schema") public class JsonSchema<SELF extends JsonSchema<SELF>> extends Object
Represents a top-level schema object bean in the JSON-Schema core specification.

This implementation follows the JSON Schema Draft 2020-12 specification.

Example:

// Create a simple schema for a person object JsonSchema schema = new JsonSchema() .setIdUri("https://example.com/person.schema.json") .setSchemaVersionUri("https://json-schema.org/draft/2020-12/schema") .setTitle("Person") .setDescription("A person object") .setType(JsonType.OBJECT) .addProperties( new JsonSchemaProperty("firstName", JsonType.STRING) .setMinLength(1) .setMaxLength(50), new JsonSchemaProperty("lastName", JsonType.STRING) .setMinLength(1) .setMaxLength(50), new JsonSchemaProperty("age", JsonType.INTEGER) .setMinimum(0) .setExclusiveMaximum(150) ) .addRequired("firstName", "lastName"); // Serialize to JSON Schema String json = JsonSerializer.DEFAULT.write(schema);

Output:

{ "$id": "https://example.com/person.schema.json", "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "Person", "description": "A person object", "type": "object", "properties": { "firstName": { "type": "string", "minLength": 1, "maxLength": 50 }, "lastName": { "type": "string", "minLength": 1, "maxLength": 50 }, "age": { "type": "integer", "minimum": 0, "exclusiveMaximum": 150 } }, "required": ["firstName", "lastName"] }

Key Features:
  • Draft 2020-12 Support: Includes all properties from the latest JSON Schema specification
  • Backward Compatibility: Deprecated Draft 04 properties (like id and definitions) are still supported
  • Fluent API: All setter methods return this for method chaining
  • Type Safety: Uses enums and typed collections for validation
  • Serialization: Can be serialized to any format supported by Juneau (JSON, XML, HTML, etc.)
  • Auto Generation: Use JsonSchemaBeanGenerator to generate schemas from Java types
Common Use Cases:

1. Simple Type Constraints:

// String with length constraints JsonSchema schema = new JsonSchema() .setType(JsonType.STRING) .setMinLength(5) .setMaxLength(100) .setPattern("^[A-Za-z]+$");

2. Numeric Ranges:

// Number between 0 and 100 (exclusive) JsonSchema schema = new JsonSchema() .setType(JsonType.NUMBER) .setExclusiveMinimum(0) .setExclusiveMaximum(100) .setMultipleOf(0.5);

3. Enumerations:

// Status field with allowed values JsonSchema schema = new JsonSchema() .setType(JsonType.STRING) .addEnum("pending", "active", "completed");

4. Arrays:

// Array of strings with constraints JsonSchema schema = new JsonSchema() .setType(JsonType.ARRAY) .setItems(new JsonSchema().setType(JsonType.STRING)) .setMinItems(1) .setMaxItems(10) .setUniqueItems(true);

5. Conditional Schemas (Draft 07+):

// Different validation based on country JsonSchema schema = new JsonSchema() .setType(JsonType.OBJECT) .addProperties( new JsonSchemaProperty("country", JsonType.STRING), new JsonSchemaProperty("postalCode", JsonType.STRING) ) .setIf(new JsonSchema() .addProperties(new JsonSchemaProperty("country").setConst("USA")) ) .setThen(new JsonSchema() .addProperties(new JsonSchemaProperty("postalCode").setPattern("^[0-9]{5}$")) );

6. Reusable Definitions:

// Schema with reusable components using $defs JsonSchema schema = new JsonSchema() .setType(JsonType.OBJECT) .addDef("address", new JsonSchema() .setType(JsonType.OBJECT) .addProperties( new JsonSchemaProperty("street", JsonType.STRING), new JsonSchemaProperty("city", JsonType.STRING) ) ) .addProperties( new JsonSchemaProperty("billingAddress") .setRef("#/$defs/address"), new JsonSchemaProperty("shippingAddress") .setRef("#/$defs/address") );

Migration from Draft 04:
See Also:
  • Constructor Details

    • JsonSchema

      public JsonSchema()
      Default constructor.
  • Method Details

    • of

      public static JsonSchema<?> of(Type type)
      Generates a JsonSchema bean from the specified type using JsonSchemaBeanGenerator.DEFAULT.
      Parameters:
      type - The type to generate a schema for. Must not be null, or an IllegalArgumentException is thrown.
      Returns:
      The generated schema bean, or null if a schema could not be generated for the type.
    • of

      public static JsonSchema<?> of(Class<?> type)
      Generates a JsonSchema bean from the specified class using JsonSchemaBeanGenerator.DEFAULT.
      Parameters:
      type - The class to generate a schema for. Must not be null, or an IllegalArgumentException is thrown.
      Returns:
      The generated schema bean, or null if a schema could not be generated for the class.
    • addAdditionalItems

      public SELF addAdditionalItems(JsonSchema<?>... value)
      Bean property appender: additionalItems.
      Parameters:
      value - The list of items to append to the additionalItems property on this bean.
      Returns:
      This object.
    • addAllOf

      public SELF addAllOf(JsonSchema<?>... value)
      Bean property appender: allOf.
      Parameters:
      value - The list of items to append to the allOf property on this bean.
      Returns:
      This object.
    • addAllOf

      public SELF addAllOf(Collection<JsonSchema<?>> value)
      Bean property appender: allOf.
      Parameters:
      value - The collection of items to append to the allOf property on this bean.
      Returns:
      This object.
    • addAnyOf

      public SELF addAnyOf(JsonSchema<?>... value)
      Bean property appender: anyOf.
      Parameters:
      value - The list of items to append to the anyOf property on this bean.
      Returns:
      This object.
    • addAnyOf

      public SELF addAnyOf(Collection<JsonSchema<?>> value)
      Bean property appender: anyOf.
      Parameters:
      value - The collection of items to append to the anyOf property on this bean.
      Returns:
      This object.
    • addDef

      public SELF addDef(String name, JsonSchema<?> value)
      Bean property appender: $defs.
      Parameters:
      name - The key in the defs map entry. Can be null (LinkedHashMap tolerates a null key).
      value - The value in the defs map entry. Can be null (stored as null).
      Returns:
      This object.
    • addDefinition

      public SELF addDefinition(String name, JsonSchema<?> value)
      Bean property appender: definitions.
      Parameters:
      name - The key in the definitions map entry. Can be null (LinkedHashMap tolerates a null key).
      value - The value in the definitions map entry. Can be null (stored as null).
      Returns:
      This object.
    • addDependency

      public SELF addDependency(String name, JsonSchema<?> value)
      Bean property appender: dependencies.
      Parameters:
      name - The key of the entry in the dependencies map. Can be null (LinkedHashMap tolerates a null key).
      value - The value of the entry in the dependencies map. Can be null (stored as null).
      Returns:
      This object.
    • addDependentRequired

      public SELF addDependentRequired(String name, List<String> value)
      Bean property appender: dependentRequired.
      Parameters:
      name - The key of the entry in the dependentRequired map. Can be null (LinkedHashMap tolerates a null key).
      value - The value of the entry in the dependentRequired map. Can be null (stored as null).
      Returns:
      This object.
    • addDependentSchema

      public SELF addDependentSchema(String name, JsonSchema<?> value)
      Bean property appender: dependentSchemas.
      Parameters:
      name - The key of the entry in the dependentSchemas map. Can be null (LinkedHashMap tolerates a null key).
      value - The value of the entry in the dependentSchemas map. Can be null (stored as null).
      Returns:
      This object.
    • addEnum

      public SELF addEnum(Object... value)
      Bean property appender: enum.
      Parameters:
      value - The list of items to append to the enum property on this bean.
      Returns:
      This object.
    • addEnum

      public SELF addEnum(Collection<Object> value)
      Bean property appender: enum.
      Parameters:
      value - The collection of items to append to the enum property on this bean.
      Returns:
      This object.
    • addExamples

      public SELF addExamples(Object... value)
      Bean property appender: examples.
      Parameters:
      value - The list of items to append to the examples property on this bean.
      Returns:
      This object.
    • addExamples

      public SELF addExamples(Collection<Object> value)
      Bean property appender: examples.
      Parameters:
      value - The collection of items to append to the examples property on this bean.
      Returns:
      This object.
    • addItems

      public SELF addItems(JsonSchema<?>... value)
      Bean property appender: items.
      Parameters:
      value - The list of items to append to the items property on this bean.
      Returns:
      This object.
    • addOneOf

      public SELF addOneOf(JsonSchema<?>... value)
      Bean property appender: oneOf.
      Parameters:
      value - The list of items to append to the oneOf property on this bean.
      Returns:
      This object.
    • addOneOf

      public SELF addOneOf(Collection<JsonSchema<?>> value)
      Bean property appender: oneOf.
      Parameters:
      value - The collection of items to append to the oneOf property on this bean.
      Returns:
      This object.
    • addPatternProperties

      Bean property appender: patternProperties.

      Properties must have their name property set to the pattern string when using this method.

      Parameters:
      value - The list of items to append to the patternProperties property on this bean.
      Returns:
      This object.
      Throws:
      BeanRuntimeException - If property is found without a set name property.
    • addPatternProperty

      public SELF addPatternProperty(String name, JsonSchema<?> value)
      Bean property appender: patternProperties.

      Unlike addPatternProperties(JsonSchemaProperty...), this keyed form does not require the value's name property to be pre-set — it is set automatically from name.

      Parameters:
      name - The key in the patternProperties map entry. Can be null (LinkedHashMap tolerates a null key).
      value - The value in the patternProperties map entry. Can be null (stored as null).
      Returns:
      This object.
    • addPrefixItems

      public SELF addPrefixItems(JsonSchema<?>... value)
      Bean property appender: prefixItems.
      Parameters:
      value - The list of items to append to the prefixItems property on this bean.
      Returns:
      This object.
    • addProperties

      public SELF addProperties(JsonSchema<?>... value)
      Bean property appender: properties.

      Properties must have their name property set on them when using this method.

      Parameters:
      value - The list of items to append to the properties property on this bean.
      Returns:
      This object.
      Throws:
      BeanRuntimeException - If property is found without a set name property.
    • addProperty

      public SELF addProperty(String name, JsonSchema<?> value)
      Bean property appender: properties.

      Unlike addProperties(JsonSchema...), this keyed form does not require the value's name property to be pre-set — it is set automatically from name.

      Parameters:
      name - The key in the properties map entry. Can be null (LinkedHashMap tolerates a null key).
      value - The value in the properties map entry. Can be null (stored as null).
      Returns:
      This object.
    • addRequired

      public SELF addRequired(JsonSchemaProperty<?>... value)
      Bean property appender: required.
      Parameters:
      value - The list of items to append to the required property on this bean.
      Returns:
      This object.
    • addRequired

      public SELF addRequired(List<String> value)
      Bean property appender: required.
      Parameters:
      value - The list of items to append to the required property on this bean.
      Returns:
      This object.
    • addRequired

      public SELF addRequired(String... value)
      Bean property appender: required.
      Parameters:
      value - The list of items to append to the required property on this bean.
      Returns:
      This object.
    • addTypes

      public SELF addTypes(JsonType... value)
      Bean property appender: type.
      Parameters:
      value - The list of items to append to the type property on this bean.
      Returns:
      This object.
    • getAdditionalItems

      Bean property getter: additionalItems.
      Returns:
      The value of the additionalItems property on this bean, or null if it is not set. Can be either a Boolean or JsonSchemaArray depending on what value was used to set it.
    • getAdditionalItemsAsBoolean

      Bean property getter: additionalItems.

      Convenience method for returning the additionalItems property when it is a Boolean value.

      Returns:
      The currently set value, or null if the property is not set, or is set as a JsonSchemaArray.
    • getAdditionalItemsAsSchemaArray

      Bean property getter: additionalItems.

      Convenience method for returning the additionalItems property when it is a JsonSchemaArray value.

      Returns:
      The currently set value, or null if the property is not set, or is set as a Boolean.
    • getAdditionalProperties

      Bean property getter: additionalProperties.
      Returns:
      The value of the additionalProperties property on this bean, or null if it is not set. Can be either a Boolean or JsonSchema depending on what value was used to set it.
    • getAdditionalPropertiesAsBoolean

      Bean property getter: additionalProperties.

      Convenience method for returning the additionalProperties property when it is a Boolean value.

      Returns:
      The currently set value, or null if the property is not set, or is set as a JsonSchema.
    • getAdditionalPropertiesAsSchema

      Bean property getter: additionalProperties.

      Convenience method for returning the additionalProperties property when it is a JsonSchema value.

      Returns:
      The currently set value, or null if the property is not set, or is set as a Boolean.
    • getAllOf

      public List<JsonSchema<?>> getAllOf()
      Bean property getter: allOf.
      Returns:
      The value of the allOf property on this bean, or null if it is not set.
    • getAnyOf

      public List<JsonSchema<?>> getAnyOf()
      Bean property getter: anyOf.
      Returns:
      The value of the anyOf property on this bean, or null if it is not set.
    • getConst

      public Object getConst()
      Bean property getter: const.

      This property was added in Draft 06.

      Returns:
      The value of the const property on this bean, or null if it is not set.
    • getContentEncoding

      Bean property getter: contentEncoding.

      This property was added in Draft 07.

      Returns:
      The value of the contentEncoding property on this bean, or null if it is not set.
    • getContentMediaType

      Bean property getter: contentMediaType.

      This property was added in Draft 07.

      Returns:
      The value of the contentMediaType property on this bean, or null if it is not set.
    • getDeprecated

      Bean property getter: deprecated.

      This property was added in Draft 2019-09.

      Returns:
      The value of the deprecated property on this bean, or null if it is not set.
    • getComment

      @BeanProp("$comment") public String getComment()
      Bean property getter: $comment.

      This property was added in Draft 07.

      Returns:
      The value of the $comment property on this bean, or null if it is not set.
    • getDefinitions

      Bean property getter: definitions.

      Deprecated: Use getDefs() for Draft 2020-12 compliance. This property is retained for Draft 04 backward compatibility.

      Returns:
      The value of the definitions property on this bean, or null if it is not set.
    • getDefs

      @BeanProp("$defs") public Map<String,JsonSchema<?>> getDefs()
      Bean property getter: $defs.

      This is the Draft 2020-12 replacement for definitions. Both properties are supported for backward compatibility.

      Returns:
      The value of the $defs property on this bean, or null if it is not set.
    • getDependencies

      Bean property getter: dependencies.
      Returns:
      The value of the dependencies property on this bean, or null if it is not set.
    • getFormat

      public String getFormat()
      Bean property getter: format.
      Returns:
      The value of the format property on this bean, or null if it is not set.
    • getDependentRequired

      Bean property getter: dependentRequired.

      This property was added in Draft 2019-09 as a replacement for the array form of dependencies.

      Returns:
      The value of the dependentRequired property on this bean, or null if it is not set.
    • getDependentSchemas

      Bean property getter: dependentSchemas.

      This property was added in Draft 2019-09 as a replacement for the schema form of dependencies.

      Returns:
      The value of the dependentSchemas property on this bean, or null if it is not set.
    • getDescription

      Bean property getter: description.
      Returns:
      The value of the description property, or null if it is not set.
    • getElse

      @BeanProp("else") public JsonSchema<?> getElse()
      Bean property getter: else.

      This property was added in Draft 07 for conditional schema application.

      Returns:
      The value of the else property on this bean, or null if it is not set.
    • getEnum

      public List<Object> getEnum()
      Bean property getter: enum.
      Returns:
      The value of the enum property on this bean, or null if it is not set.
    • getExamples

      public List<Object> getExamples()
      Bean property getter: examples.

      This property was added in Draft 06.

      Returns:
      The value of the examples property on this bean, or null if it is not set.
    • getExclusiveMaximum

      Bean property getter: exclusiveMaximum.

      In Draft 06+, this is a numeric value representing the exclusive upper bound. In Draft 04, this was a boolean flag. This implementation uses the Draft 06+ semantics.

      Returns:
      The value of the exclusiveMaximum property on this bean, or null if it is not set.
    • getExclusiveMinimum

      Bean property getter: exclusiveMinimum.

      In Draft 06+, this is a numeric value representing the exclusive lower bound. In Draft 04, this was a boolean flag. This implementation uses the Draft 06+ semantics.

      Returns:
      The value of the exclusiveMinimum property on this bean, or null if it is not set.
    • getId

      @Deprecated(since="10.0", forRemoval=true) public URI getId()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use getIdUri() instead.
      Bean property getter: id.

      Deprecated: Use getIdUri() instead. This property is retained for Draft 04 backward compatibility.

      Returns:
      The value of the id property on this bean, or null if it is not set.
    • getIdUri

      @BeanProp("$id") public URI getIdUri()
      Bean property getter: $id.

      This is the Draft 2020-12 property for schema identification.

      Returns:
      The value of the $id property on this bean, or null if it is not set.
    • getIf

      @BeanProp("if") public JsonSchema<?> getIf()
      Bean property getter: if.

      This property was added in Draft 07 for conditional schema application.

      Returns:
      The value of the if property on this bean, or null if it is not set.
    • getItems

      Bean property getter: items.
      Returns:
      The value of the items property on this bean, or null if it is not set. Can be either a JsonSchema or JsonSchemaArray depending on what value was used to set it.
    • getItemsAsSchema

      Bean property getter: items.

      Convenience method for returning the items property when it is a JsonSchema value.

      Returns:
      The currently set value, or null if the property is not set, or is set as a JsonSchemaArray.
    • getItemsAsSchemaArray

      Bean property getter: items.

      Convenience method for returning the items property when it is a JsonSchemaArray value.

      Returns:
      The currently set value, or null if the property is not set, or is set as a JsonSchema.
    • getMaximum

      public Number getMaximum()
      Bean property getter: maximum.
      Returns:
      The value of the maximum property on this bean, or null if it is not set.
    • getMaxItems

      public Integer getMaxItems()
      Bean property getter: maxItems.
      Returns:
      The value of the maxItems property on this bean, or null if it is not set.
    • getMaxLength

      Bean property getter: maxLength.
      Returns:
      The value of the maxLength property on this bean, or null if it is not set.
    • getMaxProperties

      Bean property getter: maxProperties.
      Returns:
      The value of the maxProperties property on this bean, or null if it is not set.
    • getMinimum

      public Number getMinimum()
      Bean property getter: minimum.
      Returns:
      The value of the minimum property on this bean, or null if it is not set.
    • getMinItems

      public Integer getMinItems()
      Bean property getter: minItems.
      Returns:
      The value of the minItems property on this bean, or null if it is not set.
    • getMinLength

      Bean property getter: minLength.
      Returns:
      The value of the minLength property on this bean, or null if it is not set.
    • getMinProperties

      Bean property getter: minProperties.
      Returns:
      The value of the minProperties property on this bean, or null if it is not set.
    • getMultipleOf

      Bean property getter: multipleOf.
      Returns:
      The value of the multipleOf property on this bean, or null if it is not set.
    • getName

      Bean property getter: name.

      This is an internal property used for tracking property names and is not part of the JSON Schema specification.

      Returns:
      The value of the name property on this bean, or null if it is not set.
    • getNot

      public JsonSchema<?> getNot()
      Bean property getter: not.
      Returns:
      The value of the not property on this bean, or null if it is not set.
    • getOneOf

      public List<JsonSchema<?>> getOneOf()
      Bean property getter: oneOf.
      Returns:
      The value of the oneOf property on this bean, or null if it is not set.
    • getPattern

      public String getPattern()
      Bean property getter: pattern.
      Returns:
      The value of the pattern property on this bean, or null if it is not set.
    • getPatternProperties

      Bean property getter: patternProperties.
      Returns:
      The value of the patternProperties property on this bean, or null if it is not set.
    • getPrefixItems

      Bean property getter: prefixItems.

      This property was added in Draft 2020-12 for tuple validation.

      Returns:
      The value of the prefixItems property on this bean, or null if it is not set.
    • getProperties

      Bean property getter: properties.
      Returns:
      The value of the properties property on this bean, or null if it is not set.
    • getProperty

      public JsonSchema<?> getProperty(String name)
      Returns the property with the specified name.

      This is equivalent to calling getProperty(name, false).

      Parameters:
      name - The property name. Can be null (no property has a null name, so null is returned).
      Returns:
      The property with the specified name, or null if no property is specified.
    • getProperty

      public JsonSchema<?> getProperty(String name, boolean resolve)
      Returns the property with the specified name.

      If resolve is true, the property object will automatically be resolved by calling resolve(). Therefore, getProperty(name, true) is equivalent to calling getProperty(name).resolve(), except it's safe from a potential NullPointerException.

      Parameters:
      name - The property name. Can be null (no property has a null name, so null is returned).
      resolve - If true, calls resolve() on object before returning.
      Returns:
      The property with the specified name, or null if no property is specified.
    • getReadOnly

      public Boolean getReadOnly()
      Bean property getter: readOnly.

      This property was added in Draft 07.

      Returns:
      The value of the readOnly property on this bean, or null if it is not set.
    • getRef

      @BeanProp("$ref") public URI getRef()
      Bean property getter: $ref.
      Returns:
      The value of the $ref property on this bean, or null if it is not set.
    • getRequired

      public List<String> getRequired()
      Bean property getter: required.
      Returns:
      The value of the required property on this bean, or null if it is not set.
    • getSchemaVersionUri

      @BeanProp("$schema") public URI getSchemaVersionUri()
      Bean property getter: $schema.
      Returns:
      The value of the $schema property on this bean, or null if it is not set.
    • getThen

      @BeanProp("then") public JsonSchema<?> getThen()
      Bean property getter: then.

      This property was added in Draft 07 for conditional schema application.

      Returns:
      The value of the then property on this bean, or null if it is not set.
    • getSummary

      public String getSummary()
      Bean property getter: summary.

      A short, concise summary of the schema's purpose, intended for AI/LLM consumption, compact documentation, or any context where brevity is important. Unlike getDescription(), which can be multi-line and detailed, this value should be a single sentence or phrase.

      This is a Juneau extension. It serializes as the JSON Schema keyword "summary".

      Returns:
      The value of the summary property, or null if it is not set.
      Since:
      10.0.0
    • getTitle

      public String getTitle()
      Bean property getter: title.
      Returns:
      The value of the title property, or null if it is not set.
    • getType

      Bean property getter: type.
      Returns:
      The value of the type property on this bean, or null if it is not set. Can be either a JsonType or JsonTypeArray depending on what value was used to set it.
    • getTypeAsJsonType

      Bean property getter: type.

      Convenience method for returning the type property when it is a JsonType value.

      Returns:
      The currently set value, or null if the property is not set, or is set as a JsonTypeArray.
    • getTypeAsJsonTypeArray

      Bean property getter: type.

      Convenience method for returning the type property when it is a JsonTypeArray value.

      Returns:
      The currently set value, or null if the property is not set, or is set as a JsonType.
    • getUnevaluatedItems

      Bean property getter: unevaluatedItems.

      This property was added in Draft 2019-09.

      Returns:
      The value of the unevaluatedItems property on this bean, or null if it is not set.
    • getUnevaluatedProperties

      Bean property getter: unevaluatedProperties.

      This property was added in Draft 2019-09.

      Returns:
      The value of the unevaluatedProperties property on this bean, or null if it is not set.
    • getUniqueItems

      Bean property getter: uniqueItems.
      Returns:
      The value of the uniqueItems property on this bean, or null if it is not set.
    • getWriteOnly

      Bean property getter: writeOnly.

      This property was added in Draft 07.

      Returns:
      The value of the writeOnly property on this bean, or null if it is not set.
    • resolve

      public JsonSchema<?> resolve()
      Resolve schema if reference.

      If this schema is a reference to another schema (has its $ref property set), this method will retrieve the referenced schema from the schema map registered with this schema.

      If this schema is not a reference, or no schema map is registered with this schema, this method is a no-op and simply returns this object.

      Returns:
      The referenced schema, or null if this schema is a $ref whose target is not found in the registered schema map.
    • setAdditionalItems

      public SELF setAdditionalItems(Object value)
      Bean property setter: additionalItems.
      Parameters:
      value - The new value for the additionalItems property on this bean. This object must be of type Boolean or JsonSchemaArray.
      Can be null to unset the property.
      Returns:
      This object.
      Throws:
      BeanRuntimeException - If invalid object type passed in.
    • setAdditionalProperties

      Bean property setter: additionalProperties.
      Parameters:
      value - The new value for the additionalProperties property on this bean. This object must be of type Boolean or JsonSchema.
      Can be null to unset the property.
      Returns:
      This object.
      Throws:
      BeanRuntimeException - If invalid object type passed in.
    • setAllOf

      public SELF setAllOf(List<JsonSchema<?>> value)
      Bean property setter: allOf.
      Parameters:
      value - The new value for the allOf property on this bean.
      Returns:
      This object.
    • setAllOf

      public SELF setAllOf(JsonSchema<?>... value)
      Bean property setter: allOf.
      Parameters:
      value - The new value for the allOf property on this bean.
      Returns:
      This object.
    • setAnyOf

      public SELF setAnyOf(List<JsonSchema<?>> value)
      Bean property setter: anyOf.
      Parameters:
      value - The new value of the anyOf property on this bean.
      Returns:
      This object.
    • setAnyOf

      public SELF setAnyOf(JsonSchema<?>... value)
      Bean property setter: anyOf.
      Parameters:
      value - The new value for the anyOf property on this bean.
      Returns:
      This object.
    • setConst

      public SELF setConst(Object value)
      Bean property setter: const.

      This property was added in Draft 06.

      Parameters:
      value - The new value for the const property on this bean.
      Returns:
      This object.
    • setContentEncoding

      public SELF setContentEncoding(String value)
      Bean property setter: contentEncoding.

      This property was added in Draft 07.

      Parameters:
      value - The new value for the contentEncoding property on this bean.
      Returns:
      This object.
    • setContentMediaType

      Bean property setter: contentMediaType.

      This property was added in Draft 07.

      Parameters:
      value - The new value for the contentMediaType property on this bean.
      Returns:
      This object.
    • setDeprecated

      public SELF setDeprecated(Boolean value)
      Bean property setter: deprecated.

      This property was added in Draft 2019-09.

      Parameters:
      value - The new value for the deprecated property on this bean.
      Returns:
      This object.
    • setComment

      @BeanProp("$comment") public SELF setComment(String value)
      Bean property setter: $comment.

      This property was added in Draft 07.

      Parameters:
      value - The new value for the $comment property on this bean.
      Returns:
      This object.
    • setDefinitions

      public SELF setDefinitions(Map<String,JsonSchema<?>> value)
      Bean property setter: definitions.
      Parameters:
      value - The new value for the definitions property on this bean.
      Returns:
      This object.
    • setDefs

      @BeanProp("$defs") public SELF setDefs(Map<String,JsonSchema<?>> value)
      Bean property setter: $defs.

      This is the Draft 2020-12 replacement for definitions. Both properties are supported for backward compatibility.

      Parameters:
      value - The new value for the $defs property on this bean.
      Returns:
      This object.
    • setDependencies

      Bean property setter: dependencies.
      Parameters:
      value - The new value for the dependencies property on this bean.
      Returns:
      This object.
    • setFormat

      public SELF setFormat(String value)
      Bean property setter: format.
      Parameters:
      value - The new value for the format property on this bean.
      Returns:
      This object.
    • setDependentRequired

      Bean property setter: dependentRequired.

      This property was added in Draft 2019-09 as a replacement for the array form of dependencies.

      Parameters:
      value - The new value for the dependentRequired property on this bean.
      Returns:
      This object.
    • setDependentSchemas

      Bean property setter: dependentSchemas.

      This property was added in Draft 2019-09 as a replacement for the schema form of dependencies.

      Parameters:
      value - The new value for the dependentSchemas property on this bean.
      Returns:
      This object.
    • setDescription

      public SELF setDescription(String value)
      Bean property setter: description.
      Parameters:
      value - The new value for the description property on this bean.
      Returns:
      This object.
    • setElse

      @BeanProp("else") public SELF setElse(JsonSchema<?> value)
      Bean property setter: else.

      This property was added in Draft 07 for conditional schema application.

      Parameters:
      value - The new value for the else property on this bean.
      Returns:
      This object.
    • setEnum

      public SELF setEnum(List<Object> value)
      Bean property setter: enum.
      Parameters:
      value - The new value for the enum property on this bean.
      Returns:
      This object.
    • setEnum

      public SELF setEnum(Object... value)
      Bean property setter: enum.
      Parameters:
      value - The new value for the enum property on this bean.
      Returns:
      This object.
    • setExamples

      public SELF setExamples(List<Object> value)
      Bean property setter: examples.

      This property was added in Draft 06.

      Parameters:
      value - The new value for the examples property on this bean.
      Returns:
      This object.
    • setExamples

      public SELF setExamples(Object... value)
      Bean property setter: examples.

      This property was added in Draft 06.

      Parameters:
      value - The new value for the examples property on this bean.
      Returns:
      This object.
    • setExclusiveMaximum

      Bean property setter: exclusiveMaximum.

      In Draft 06+, this is a numeric value representing the exclusive upper bound. In Draft 04, this was a boolean flag. This implementation uses the Draft 06+ semantics.

      Parameters:
      value - The new value for the exclusiveMaximum property on this bean.
      Returns:
      This object.
    • setExclusiveMinimum

      Bean property setter: exclusiveMinimum.

      In Draft 06+, this is a numeric value representing the exclusive lower bound. In Draft 04, this was a boolean flag. This implementation uses the Draft 06+ semantics.

      Parameters:
      value - The new value for the exclusiveMinimum property on this bean.
      Returns:
      This object.
    • setId

      @Deprecated(since="10.0", forRemoval=true) public SELF setId(Object value)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use setIdUri(Object) instead.
      Bean property setter: id.

      Deprecated: Use setIdUri(Object) instead. This property is retained for Draft 04 backward compatibility.

      The value can be of any of the following types: URI, URL, String. Strings must be valid URIs.

      URIs defined by UriResolver can be used for values.

      Parameters:
      value - The new value for the id property on this bean. Can be null to unset the property.
      Returns:
      This object.
    • setIdUri

      @BeanProp("$id") public SELF setIdUri(Object value)
      Bean property setter: $id.

      This is the Draft 2020-12 property for schema identification.

      The value can be of any of the following types: URI, URL, String. Strings must be valid URIs.

      URIs defined by UriResolver can be used for values.

      Parameters:
      value - The new value for the $id property on this bean. Can be null to unset the property.
      Returns:
      This object.
    • setIf

      @BeanProp("if") public SELF setIf(JsonSchema<?> value)
      Bean property setter: if.

      This property was added in Draft 07 for conditional schema application.

      Parameters:
      value - The new value for the if property on this bean.
      Returns:
      This object.
    • setItems

      public SELF setItems(Object value)
      Bean property setter: items.
      Parameters:
      value - The new value for the items property on this bean. This object must be of type JsonSchema or JsonSchemaArray.
      Can be null to unset the property.
      Returns:
      This object.
      Throws:
      BeanRuntimeException - If invalid object type passed in.
    • setMaximum

      public SELF setMaximum(Number value)
      Bean property setter: maximum.
      Parameters:
      value - The new value for the maximum property on this bean.
      Returns:
      This object.
    • setMaxItems

      public SELF setMaxItems(Integer value)
      Bean property setter: maxItems.
      Parameters:
      value - The new value for the maxItems property on this bean.
      Returns:
      This object.
    • setMaxLength

      public SELF setMaxLength(Integer value)
      Bean property setter: maxLength.
      Parameters:
      value - The new value for the maxLength property on this bean.
      Returns:
      This object.
    • setMaxProperties

      public SELF setMaxProperties(Integer value)
      Bean property setter: maxProperties.
      Parameters:
      value - The new value for the maxProperties property on this bean.
      Returns:
      This object.
    • setMinimum

      public SELF setMinimum(Number value)
      Bean property setter: minimum.
      Parameters:
      value - The new value for the minimum property on this bean.
      Returns:
      This object.
    • setMinItems

      public SELF setMinItems(Integer value)
      Bean property setter: minItems.
      Parameters:
      value - The new value for the minItems property on this bean.
      Returns:
      This object.
    • setMinLength

      public SELF setMinLength(Integer value)
      Bean property setter: minLength.
      Parameters:
      value - The new value for the minLength property on this bean.
      Returns:
      This object.
    • setMinProperties

      public SELF setMinProperties(Integer value)
      Bean property setter: minProperties.
      Parameters:
      value - The new value for the minProperties property on this bean.
      Returns:
      This object.
    • setMultipleOf

      public SELF setMultipleOf(Number value)
      Bean property setter: multipleOf.
      Parameters:
      value - The new value for the multipleOf property on this bean.
      Returns:
      This object.
    • setName

      @BeanIgnore public SELF setName(String value)
      Bean property setter: name.

      This is an internal property used for tracking property names and is not part of the JSON Schema specification.

      Parameters:
      value - The new value for the name property on this bean.
      Returns:
      This object.
    • setNot

      public SELF setNot(JsonSchema<?> value)
      Bean property setter: not.
      Parameters:
      value - The new value for the not property on this bean.
      Returns:
      This object.
    • setOneOf

      public SELF setOneOf(List<JsonSchema<?>> value)
      Bean property setter: oneOf.
      Parameters:
      value - The new value for the oneOf property on this bean.
      Returns:
      This object.
    • setOneOf

      public SELF setOneOf(JsonSchema<?>... value)
      Bean property setter: oneOf.
      Parameters:
      value - The new value for the oneOf property on this bean.
      Returns:
      This object.
    • setPattern

      public SELF setPattern(String value)
      Bean property setter: pattern.
      Parameters:
      value - The new value for the pattern property on this bean.
      Returns:
      This object.
    • setPatternProperties

      Bean property setter: patternProperties.
      Parameters:
      value - The new value for the patternProperties property on this bean.
      Returns:
      This object.
    • setPrefixItems

      Bean property setter: prefixItems.

      This property was added in Draft 2020-12 for tuple validation.

      Parameters:
      value - The new value for the prefixItems property on this bean.
      Returns:
      This object.
    • setProperties

      public SELF setProperties(Map<String,JsonSchema<?>> value)
      Bean property setter: properties.
      Parameters:
      value - The new value for the properties property on this bean.
      Returns:
      This object.
    • setReadOnly

      public SELF setReadOnly(Boolean value)
      Bean property setter: readOnly.

      This property was added in Draft 07.

      Parameters:
      value - The new value for the readOnly property on this bean.
      Returns:
      This object.
    • setRef

      @BeanProp("$ref") public SELF setRef(Object value)
      Bean property setter: $ref.

      The value can be of any of the following types: URI, URL, String. Strings must be valid URIs.

      URIs defined by UriResolver can be used for values.

      Parameters:
      value - The new value for the $ref property on this bean. Can be null to unset the property.
      Returns:
      This object.
    • setRequired

      public SELF setRequired(List<String> value)
      Bean property setter: required.
      Parameters:
      value - The new value for the required property on this bean.
      Returns:
      This object.
    • setRequired

      public SELF setRequired(String... value)
      Bean property setter: required.
      Parameters:
      value - The new value for the required property on this bean.
      Returns:
      This object.
    • setSchemaMap

      Associates a schema map with this schema for resolving other schemas identified through $ref properties.
      Parameters:
      value - The schema map to associate with this schema. Can be null to unset the property.
      Returns:
      This object.
    • setSchemaVersionUri

      @BeanProp("$schema") public SELF setSchemaVersionUri(Object value)
      Bean property setter: $schema.

      The value can be of any of the following types: URI, URL, String. Strings must be valid URIs.

      URIs defined by UriResolver can be used for values.

      Parameters:
      value - The new value for the schemaVersion property on this bean. Can be null to unset the property.
      Returns:
      This object.
    • setThen

      @BeanProp("then") public SELF setThen(JsonSchema<?> value)
      Bean property setter: then.

      This property was added in Draft 07 for conditional schema application.

      Parameters:
      value - The new value for the then property on this bean.
      Returns:
      This object.
    • setSummary

      public SELF setSummary(String value)
      Bean property setter: summary.
      Parameters:
      value - The new value for the summary property on this bean.
      Returns:
      This object.
      Since:
      10.0.0
    • setTitle

      public SELF setTitle(String value)
      Bean property setter: title.
      Parameters:
      value - The new value for the title property on this bean.
      Returns:
      This object.
    • setType

      public SELF setType(Object value)
      Bean property setter: type.
      Parameters:
      value - The new value for the type property on this bean. This object must be of type JsonType or JsonTypeArray.
      Can be null to unset the property.
      Returns:
      This object.
      Throws:
      BeanRuntimeException - If invalid object type passed in.
    • setUnevaluatedItems

      public SELF setUnevaluatedItems(JsonSchema<?> value)
      Bean property setter: unevaluatedItems.

      This property was added in Draft 2019-09.

      Parameters:
      value - The new value for the unevaluatedItems property on this bean.
      Returns:
      This object.
    • setUnevaluatedProperties

      Bean property setter: unevaluatedProperties.

      This property was added in Draft 2019-09.

      Parameters:
      value - The new value for the unevaluatedProperties property on this bean.
      Returns:
      This object.
    • setUniqueItems

      public SELF setUniqueItems(Boolean value)
      Bean property setter: uniqueItems.
      Parameters:
      value - The new value for the uniqueItems property on this bean.
      Returns:
      This object.
    • setWriteOnly

      public SELF setWriteOnly(Boolean value)
      Bean property setter: writeOnly.

      This property was added in Draft 07.

      Parameters:
      value - The new value for the writeOnly property on this bean.
      Returns:
      This object.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • setMaster

      protected void setMaster(JsonSchema<?> master)
      Sets the master schema for this schema and all child schema objects.

      All child elements in a schema should point to a single "master" schema in order to locate registered JsonSchemaMap objects for resolving external schemas.

      Parameters:
      master - The master schema to associate on this and all children. Can be null to clear the master reference on this schema and all children.