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 of
JsonSchemaIdValidator
.
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 -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
hasNoContext
(SchemaLocation schemaLocation) protected boolean
isAbsoluteIri
(String iri) protected boolean
isFragment
(String id) protected boolean
boolean
validate
(String id, boolean rootSchema, SchemaLocation schemaLocation, SchemaLocation resolvedSchemaLocation, ValidationContext validationContext) Validates if the $id value is valid.
-
Constructor Details
-
DefaultJsonSchemaIdValidator
public DefaultJsonSchemaIdValidator()
-
-
Method Details
-
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
-
isFragment
-
hasNoContext
-
isAbsoluteIri
-