Class SchemaRegistryConfig.BuilderSupport<T>

java.lang.Object
com.networknt.schema.SchemaRegistryConfig.BuilderSupport<T>
Direct Known Subclasses:
SchemaRegistryConfig.Builder
Enclosing class:
SchemaRegistryConfig

public abstract static class SchemaRegistryConfig.BuilderSupport<T> extends Object
  • Field Details

    • cacheRefs

      protected boolean cacheRefs
    • errorMessageKeyword

      protected String errorMessageKeyword
    • executionContextCustomizer

      protected ExecutionContextCustomizer executionContextCustomizer
    • failFast

      protected boolean failFast
    • formatAssertionsEnabled

      protected Boolean formatAssertionsEnabled
    • locale

      protected Locale locale
    • losslessNarrowing

      protected boolean losslessNarrowing
    • messageSource

      protected MessageSource messageSource
    • pathType

      protected PathType pathType
    • preloadSchema

      protected boolean preloadSchema
    • regularExpressionFactory

      protected RegularExpressionFactory regularExpressionFactory
    • schemaIdValidator

      protected SchemaIdValidator schemaIdValidator
    • strictness

      protected Map<String,Boolean> strictness
    • typeLoose

      protected boolean typeLoose
  • Constructor Details

    • BuilderSupport

      public BuilderSupport()
  • Method Details

    • self

      protected abstract T self()
    • cacheRefs

      public T cacheRefs(boolean cacheRefs)
      Sets if schemas loaded from refs will be cached and reused for subsequent runs.

      Defaults to true.

      Parameters:
      cacheRefs - true to cache
      Returns:
      the builder
    • errorMessageKeyword

      public T errorMessageKeyword(String errorMessageKeyword)
      Sets the error message keyword for setting custom messages in the schema.

      Defaults to null meaning custom messages are not enabled.

      Parameters:
      errorMessageKeyword - to use for custom messages in the schema
      Returns:
      the builder
    • executionContextCustomizer

      public T executionContextCustomizer(ExecutionContextCustomizer executionContextCustomizer)
      Sets the execution context customizer that is run before each run.
      Parameters:
      executionContextCustomizer - the customizer
      Returns:
      the builder
    • failFast

      public T failFast(boolean failFast)
      Sets if the validation should immediately return once a validation error has occurred. This can improve performance if inputs are invalid but cannot return all error messages to the caller.

      Defaults to false.

      Parameters:
      failFast - true to enable
      Returns:
      the builder
    • formatAssertionsEnabled

      public T formatAssertionsEnabled(Boolean formatAssertionsEnabled)
      Sets if format assertions are enabled. If format assertions are not enabled the format keyword will behave like an annotation and not attempt to validate if the inputs are valid.

      Defaults to not enabling format assertions for Draft 2019-09 and above and enabling format assertions for Draft 7 and below.

      Parameters:
      formatAssertionsEnabled - true to enable
      Returns:
      the builder
    • locale

      public T locale(Locale locale)
      Set the locale to consider when generating localized messages.

      Note that this locale is set on a schema registry basis. To configure the schema on a per execution basis use ExecutionConfig.BuilderSupport.locale(Locale).

      Defaults to use Locale.getDefault().

      Parameters:
      locale - The locale.
      Returns:
      the builder
    • losslessNarrowing

      public T losslessNarrowing(boolean losslessNarrowing)
      Sets whether lossless narrowing of other numeric types to integer is performed.

      Note that this likely only has a visible effect for dialects written before Draft 6.

      Since Draft 6 for example 1.0 is treated as an integer even without this enabled.

      Parameters:
      losslessNarrowing - true to enable
      Returns:
      the builder
    • messageSource

      public T messageSource(MessageSource messageSource)
      Sets the message source to use for generating localised messages.
      Parameters:
      messageSource - the message source
      Returns:
      the builder
    • pathType

      public T pathType(PathType pathType)
      Sets the path type to use when reporting the instance location of errors.

      Defaults to PathType.JSON_POINTER.

      Parameters:
      pathType - the path type
      Returns:
      the path type
    • preloadSchema

      public T preloadSchema(boolean preloadSchema)
      Sets if the schema should be preloaded.

      Defaults to true.

      Parameters:
      preloadSchema - true to preload
      Returns:
      the builder
    • regularExpressionFactory

      public T regularExpressionFactory(RegularExpressionFactory regularExpressionFactory)
      Sets the regular expression factory.

      Defaults to the JDKRegularExpressionFactory

      The ECMAScriptRegularExpressionFactory requires the inclusion of optional org.jruby.joni:joni or org.graalvm.js:js dependencies.

      Parameters:
      regularExpressionFactory - the factory
      Returns:
      the builder
      See Also:
    • schemaIdValidator

      public T schemaIdValidator(SchemaIdValidator schemaIdValidator)
      Sets the schema id validator to use.

      Defaults to SchemaIdValidator.DEFAULT.

      Parameters:
      schemaIdValidator - the builder
      Returns:
      the builder
    • strict

      public T strict(Map<String,Boolean> strict)
    • strict

      public T strict(String keyword, boolean strict)
    • typeLoose

      public T typeLoose(boolean typeLoose)
    • build

      public SchemaRegistryConfig build()