Class SchemaRegistryConfig

java.lang.Object
com.networknt.schema.SchemaRegistryConfig

public class SchemaRegistryConfig extends Object
Configuration for SchemaRegistry that applies to all the schemas its validators that is managed by the SchemaRegistry.
  • Constructor Details

  • Method Details

    • getInstance

      public static SchemaRegistryConfig getInstance()
      Gets the default config instance.
      Returns:
      the config
    • getExecutionContextCustomizer

      public ExecutionContextCustomizer getExecutionContextCustomizer()
    • getFormatAssertionsEnabled

      public Boolean getFormatAssertionsEnabled()
      Gets the format assertion enabled flag.

      This defaults to null meaning that it will follow the defaults of the specification.

      Since draft 2019-09 this will default to false unless enabled by using the $vocabulary keyword.

      Returns:
      the format assertions enabled flag
    • getLocale

      public Locale getLocale()
      Get the locale to consider when generating localised messages (default is the JVM default).

      This locale is on a schema basis and will be used as the default locale for ExecutionConfig.

      Returns:
      The locale.
    • getMessageSource

      public MessageSource getMessageSource()
      Get the message source to use for generating localised messages.
      Returns:
      the message source
    • getPathType

      public PathType getPathType()
      Get the approach used to generate paths in messages, logs and errors.
      Returns:
      The path generation approach.
    • getRegularExpressionFactory

      public RegularExpressionFactory getRegularExpressionFactory()
      Gets the regular expression factory.

      This defaults to the JDKRegularExpressionFactory and the implementations require inclusion of optional org.jruby.joni:joni or org.graalvm.js:js dependencies.

      Returns:
      the factory
    • getSchemaIdValidator

      public SchemaIdValidator getSchemaIdValidator()
      Gets the schema id validator to validate $id.
      Returns:
      the validator
    • isCacheRefs

      public boolean isCacheRefs()
      Gets if schemas loaded from refs will be cached and reused for subsequent runs.
      Returns:
      true if schemas loaded from refs should be cached
    • getErrorMessageKeyword

      public String getErrorMessageKeyword()
    • isFailFast

      public boolean isFailFast()
    • isLosslessNarrowing

      public boolean isLosslessNarrowing()
    • isPreloadSchema

      public boolean isPreloadSchema()
      Gets if the schema should be preloaded.
      Returns:
      true if it should be preloaded
    • isStrict

      public boolean isStrict(String keyword)
      Answers whether a keyword's validators may relax their analysis. The default is to perform strict checking. One must explicitly allow a validator to be more permissive.

      Each validator has its own understanding of what is permissive and strict. Consult the keyword's documentation for details.

      Parameters:
      keyword - the keyword to adjust (not null)
      Returns:
      Whether to perform a strict validation.
    • isStrict

      public boolean isStrict(String keyword, Boolean defaultValue)
      Determines if the validator should perform strict checking.
      Parameters:
      keyword - the keyword
      defaultValue - the default value
      Returns:
      whether to perform a strict validation
    • isTypeLoose

      public boolean isTypeLoose()
      Returns whether types are interpreted in a loose manner.

      If set to true, a single value can be interpreted as a size 1 array. Strings may also be interpreted as number, integer or boolean.

      Returns:
      true if type are interpreted in a loose manner
    • builder

      public static SchemaRegistryConfig.Builder builder()
      Creates a builder.
      Returns:
      the builder
    • builder

      public static SchemaRegistryConfig.Builder builder(SchemaRegistryConfig config)
      Copies values from a configuration to a new builder.
      Parameters:
      config - the configuration
      Returns:
      the builder