Package org.everit.json.schema
Class CombinedSchema
java.lang.Object
org.everit.json.schema.Schema
org.everit.json.schema.CombinedSchema
Validator for
allOf, oneOf, anyOf schemas.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder class forCombinedSchema.static interfaceValidation criterion. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final CombinedSchema.ValidationCriterionValidation criterion forallOfschemas.static final CombinedSchema.ValidationCriterionValidation criterion foranyOfschemas.static final CombinedSchema.ValidationCriterionValidation criterion foroneOfschemas.Fields inherited from class org.everit.json.schema.Schema
schemaLocation -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic CombinedSchema.BuilderallOf(Collection<Schema> schemas) static CombinedSchema.BuilderanyOf(Collection<Schema> schemas) static CombinedSchema.Builderbuilder()static CombinedSchema.Builderbuilder(Collection<Schema> subschemas) protected booleanSince we add state in subclasses, but want those subclasses to be non final, this allows us to have equals methods that satisfy the equals contract.booleandefinesProperty(String field) Determines if thisSchemainstance defines any restrictions for the object property denoted byfield.booleaninthashCode()static CombinedSchema.BuilderoneOf(Collection<Schema> schemas) Methods inherited from class org.everit.json.schema.Schema
describeTo, failure, failure, getDefaultValue, getDescription, getId, getLocation, getSchemaLocation, getTitle, getUnprocessedProperties, hasDefaultValue, isNullable, isReadOnly, isWriteOnly, toString, validate
-
Field Details
-
ALL_CRITERION
Validation criterion forallOfschemas. -
ANY_CRITERION
Validation criterion foranyOfschemas. -
ONE_CRITERION
Validation criterion foroneOfschemas.
-
-
Constructor Details
-
CombinedSchema
Constructor.- Parameters:
builder- the builder containing the validation criterion and the subschemas to be checked
-
-
Method Details
-
allOf
-
anyOf
-
builder
-
builder
-
oneOf
-
getCriterion
-
getSubschemas
-
definesProperty
Description copied from class:SchemaDetermines if thisSchemainstance defines any restrictions for the object property denoted byfield. Thefieldshould be a JSON pointer, denoting the property to be queried.For example the field
"#/rectangle/a"is defined by the following schema:
You can also check if a subschema of an array defines a property. In that case, to traverse the array, you can either use an integer array index, or theobjectWithSchemaRectangleDep" : { "type" : "object", "dependencies" : { "d" : { "type" : "object", "properties" : { "rectangle" : { "$ref" : "#/definitions/Rectangle" }, "list": { "type": "array", "items": { "properties": { "prop": {} } }, "minItems": 2, "maxItems: 3 } } } }, "definitions" : { "size" : { "type" : "number", "minimum" : 0 }, "Rectangle" : { "type" : "object", "properties" : { "a" : {"$ref" : "#/definitions/size"}, "b" : {"$ref" : "#/definitions/size"} } } } }"all"or"any"meta-indexes. For example, in the above schemadefinesProperty("#/list/any/prop")returnstruedefinesProperty("#/list/all/prop")returnstruedefinesProperty("#/list/1/prop")returnstruedefinesProperty("#/list/1/nonexistent")returnsfalse(the property is not present in the subschema)definesProperty("#/list/8/prop")returnsfalse(the"list"does not define property8, since"maxItems"is3)
- Overrides:
definesPropertyin classSchema- Parameters:
field- should be a JSON pointer in its string representation.- Returns:
trueif the propertty denoted byfieldis defined by this schema instance
-
equals
-
hashCode
public int hashCode() -
canEqual
Description copied from class:SchemaSince we add state in subclasses, but want those subclasses to be non final, this allows us to have equals methods that satisfy the equals contract.http://www.artima.com/lejava/articles/equality.html
-