Class SchemaIdValidator.DefaultSchemaIdValidator

java.lang.Object
com.networknt.schema.SchemaIdValidator.DefaultSchemaIdValidator
All Implemented Interfaces:
SchemaIdValidator
Enclosing interface:
SchemaIdValidator

public static class SchemaIdValidator.DefaultSchemaIdValidator extends Object implements SchemaIdValidator
Implementation of SchemaIdValidator.

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.

  • Constructor Details

    • DefaultSchemaIdValidator

      public DefaultSchemaIdValidator()
  • Method Details

    • validate

      public boolean validate(String id, boolean rootSchema, SchemaLocation schemaLocation, SchemaLocation resolvedSchemaLocation, SchemaContext schemaContext)
      Description copied from interface: SchemaIdValidator
      Validates if the $id value is valid.
      Specified by:
      validate in interface SchemaIdValidator
      Parameters:
      id - the $id or id
      rootSchema - true if this is a root schema
      schemaLocation - the schema location
      resolvedSchemaLocation - the schema location after resolving with the id
      schemaContext - the schema 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)