public class JsonSchema extends BaseJsonValidator
Modifier and Type | Field and Description |
---|---|
static java.util.regex.Pattern |
IGNITION_SCHEMA_PATTERN |
static java.lang.String |
IGNITION_SCHEMA_URN |
protected java.util.Map<java.lang.String,JsonValidator> |
validators |
AT_ROOT
Constructor and Description |
---|
JsonSchema(com.google.gson.JsonElement schemaNode) |
JsonSchema(com.google.gson.JsonElement schemaNode,
JsonSchema subSchema) |
Modifier and Type | Method and Description |
---|---|
boolean |
acceptsType(JsonType type)
Returns true if this schema accepts this type
|
JsonSchema |
findAncestor() |
java.util.Optional<JsonSchema> |
findAncestorMatchingPath(java.lang.String matchingPath) |
java.util.Optional<JsonSchema> |
findSchemaForPath(JsonPath path)
Attempts to find a sub-schema for a specific json path into a hypothetical document that this schema
might validate.
|
java.util.Optional<com.google.gson.JsonElement> |
getChildDefaultValue(JsonType type) |
java.util.List<java.lang.String> |
getDeclaredProperties() |
com.google.gson.JsonElement |
getDefaultValue()
If the schema specified a default value, it will be returned here.
|
com.google.gson.JsonElement |
getDefaultValue(boolean includeExamples)
If the schema specified a default value, it will be returned here.
|
java.lang.String |
getDescription() |
java.util.Map<java.lang.String,com.google.gson.JsonElement> |
getEnumChoices() |
java.util.List<com.google.gson.JsonElement> |
getExamples() |
java.util.Optional<com.google.gson.JsonElement> |
getExampleValue()
Returns an optional containing an example value if one exists.
|
java.lang.String |
getFormat() |
com.google.gson.JsonElement |
getRefSchemaNode(java.lang.String ref)
Find the schema node for $ref attribute.
|
java.util.Map<java.lang.String,com.google.gson.JsonElement> |
getSuggestions() |
java.lang.String |
getTitle() |
TypeValidator |
getTypeValidator()
Finds the TypeValidator associated with this schema, if there is one.
|
boolean |
isType(JsonType type)
Returns true if this schema accepts this type and only this type
|
static JsonSchema |
parse(java.io.InputStream stream) |
java.lang.String |
toString() |
java.util.Set<ValidationMessage> |
validate(com.google.gson.JsonElement jsonElement,
com.google.gson.JsonElement rootNode,
java.lang.String at)
Validate the given JsonElement, the given node is the child node of the root node at given
data path.
|
asInt, buildValidationMessage, debug, equals, getParentSchema, getSchemaNode, getSchemaPath, getSubSchema, getValidatorType, greaterThan, hasSubSchema, lessThan, obtainSubSchemaNode, parseErrorCode, useRefCache, validate
protected java.util.Map<java.lang.String,JsonValidator> validators
public static final java.lang.String IGNITION_SCHEMA_URN
public static final java.util.regex.Pattern IGNITION_SCHEMA_PATTERN
public JsonSchema(com.google.gson.JsonElement schemaNode)
public JsonSchema(com.google.gson.JsonElement schemaNode, JsonSchema subSchema)
public static JsonSchema parse(java.io.InputStream stream)
public java.util.Optional<JsonSchema> findSchemaForPath(JsonPath path)
public com.google.gson.JsonElement getRefSchemaNode(java.lang.String ref)
ref
- Stringpublic java.util.Optional<JsonSchema> findAncestorMatchingPath(java.lang.String matchingPath)
public JsonSchema findAncestor()
public java.util.Set<ValidationMessage> validate(com.google.gson.JsonElement jsonElement, com.google.gson.JsonElement rootNode, java.lang.String at)
JsonValidator
jsonElement
- JsonElementrootNode
- JsonElementat
- String@Nullable public java.lang.String getTitle()
@Nullable public java.lang.String getDescription()
@Nullable public com.google.gson.JsonElement getDefaultValue()
@Nullable public com.google.gson.JsonElement getDefaultValue(boolean includeExamples)
public java.util.Optional<com.google.gson.JsonElement> getChildDefaultValue(JsonType type)
@Nonnull public java.util.List<com.google.gson.JsonElement> getExamples()
@Nonnull public java.util.Optional<com.google.gson.JsonElement> getExampleValue()
@Nullable public java.lang.String getFormat()
@Nullable public TypeValidator getTypeValidator()
public boolean isType(JsonType type)
public boolean acceptsType(JsonType type)
public java.util.Map<java.lang.String,com.google.gson.JsonElement> getEnumChoices()
public java.util.Map<java.lang.String,com.google.gson.JsonElement> getSuggestions()
public java.util.List<java.lang.String> getDeclaredProperties()
public java.lang.String toString()
toString
in class java.lang.Object