Package org.everit.json.schema
Class ObjectSchema.Builder
- java.lang.Object
-
- org.everit.json.schema.Schema.Builder<ObjectSchema>
-
- org.everit.json.schema.ObjectSchema.Builder
-
- Enclosing class:
- ObjectSchema
public static class ObjectSchema.Builder extends Schema.Builder<ObjectSchema>
Builder class forObjectSchema
.
-
-
Field Summary
Fields Modifier and Type Field Description boolean
oneOrMoreDefaultProperty
-
Fields inherited from class org.everit.json.schema.Schema.Builder
unprocessedProperties
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
-
Methods inherited from class org.everit.json.schema.Schema.Builder
defaultValue, description, id, nullable, readOnly, schemaLocation, schemaLocation, title, unprocessedProperties, writeOnly
-
-
-
-
Method Detail
-
additionalProperties
public ObjectSchema.Builder additionalProperties(boolean additionalProperties)
-
addPropertySchema
public ObjectSchema.Builder addPropertySchema(String propName, Schema schema)
Adds a property schema.- Parameters:
propName
- the name of the property which' expected schema must beschema
schema
- if the subject under validation has a property namedpropertyName
then its value will be validated using thisschema
- Returns:
this
-
addRequiredProperty
public ObjectSchema.Builder addRequiredProperty(String propertyName)
-
build
public ObjectSchema build()
- Specified by:
build
in classSchema.Builder<ObjectSchema>
-
maxProperties
public ObjectSchema.Builder maxProperties(Integer maxProperties)
-
minProperties
public ObjectSchema.Builder minProperties(Integer minProperties)
-
patternProperty
@Deprecated public ObjectSchema.Builder patternProperty(Pattern pattern, Schema schema)
Deprecated.
-
patternProperty
@Deprecated public ObjectSchema.Builder patternProperty(String pattern, Schema schema)
Deprecated.
-
patternProperty
public ObjectSchema.Builder patternProperty(Regexp pattern, Schema schema)
-
propertyDependency
public ObjectSchema.Builder propertyDependency(String ifPresent, String mustBePresent)
Adds a property dependency.- Parameters:
ifPresent
- the name of the property which if is present then a property with namemustBePresent
is mandatorymustBePresent
- a property with this name must exist in the subject under validation if a property namedifPresent
exists- Returns:
this
-
requiresObject
public ObjectSchema.Builder requiresObject(boolean requiresObject)
-
schemaDependency
public ObjectSchema.Builder schemaDependency(String ifPresent, Schema expectedSchema)
-
schemaOfAdditionalProperties
public ObjectSchema.Builder schemaOfAdditionalProperties(Schema schemaOfAdditionalProperties)
-
propertyNameSchema
public ObjectSchema.Builder propertyNameSchema(Schema propertyNameSchema)
-
-