Package org.everit.json.schema
Class ObjectSchema
java.lang.Object
org.everit.json.schema.Schema
org.everit.json.schema.ObjectSchema
Object schema validator.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class org.everit.json.schema.Schema
schemaLocation -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectSchema.Builderbuilder()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.booleanDeprecated.inthashCode()booleanbooleanMethods inherited from class org.everit.json.schema.Schema
describeTo, failure, failure, getDefaultValue, getDescription, getId, getLocation, getSchemaLocation, getTitle, getUnprocessedProperties, hasDefaultValue, isNullable, isReadOnly, isWriteOnly, toString, validate
-
Constructor Details
-
ObjectSchema
Constructor.- Parameters:
builder- the builder object containing validation criteria
-
-
Method Details
-
builder
-
getMaxProperties
-
getMinProperties
-
getPatternProperties
Deprecated. -
getPropertyDependencies
-
getPropertySchemas
-
getRequiredProperties
-
getSchemaDependencies
-
getSchemaOfAdditionalProperties
-
getPropertyNameSchema
-
permitsAdditionalProperties
public boolean permitsAdditionalProperties() -
requiresObject
public boolean requiresObject() -
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
-