Package com.networknt.schema
Class JsonSchemaIdValidator.DefaultJsonSchemaIdValidator
- java.lang.Object
-
- com.networknt.schema.JsonSchemaIdValidator.DefaultJsonSchemaIdValidator
-
- All Implemented Interfaces:
JsonSchemaIdValidator
- Enclosing interface:
- JsonSchemaIdValidator
public static class JsonSchemaIdValidator.DefaultJsonSchemaIdValidator extends Object implements JsonSchemaIdValidator
Implementation ofJsonSchemaIdValidator
.Note that this does not strictly follow the specification.
This allows an $id that isn't an absolute-IRI on the root schema but it must resolve to an absolute-IRI given a base-IRI.
This also allows non-empty fragments.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.networknt.schema.JsonSchemaIdValidator
JsonSchemaIdValidator.DefaultJsonSchemaIdValidator
-
-
Field Summary
-
Fields inherited from interface com.networknt.schema.JsonSchemaIdValidator
DEFAULT
-
-
Constructor Summary
Constructors Constructor Description DefaultJsonSchemaIdValidator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
hasNoContext(SchemaLocation schemaLocation)
protected boolean
isAbsoluteIri(String iri)
protected boolean
isFragment(String id)
protected boolean
startsWithSlash(String id)
boolean
validate(String id, boolean rootSchema, SchemaLocation schemaLocation, SchemaLocation resolvedSchemaLocation, ValidationContext validationContext)
Validates if the $id value is valid.
-
-
-
Method Detail
-
validate
public boolean validate(String id, boolean rootSchema, SchemaLocation schemaLocation, SchemaLocation resolvedSchemaLocation, ValidationContext validationContext)
Description copied from interface:JsonSchemaIdValidator
Validates if the $id value is valid.- Specified by:
validate
in interfaceJsonSchemaIdValidator
- Parameters:
id
- the $id or idrootSchema
- true if this is a root schemaschemaLocation
- the schema locationresolvedSchemaLocation
- the schema location after resolving with the idvalidationContext
- the validation context for instance to get the meta schema- Returns:
- true if valid
-
startsWithSlash
protected boolean startsWithSlash(String id)
-
isFragment
protected boolean isFragment(String id)
-
hasNoContext
protected boolean hasNoContext(SchemaLocation schemaLocation)
-
isAbsoluteIri
protected boolean isAbsoluteIri(String iri)
-
-