Class SchemaRegistryConfig.BuilderSupport<T>

    • Field Detail

      • cacheRefs

        protected boolean cacheRefs
      • errorMessageKeyword

        protected String errorMessageKeyword
      • failFast

        protected boolean failFast
      • formatAssertionsEnabled

        protected Boolean formatAssertionsEnabled
      • locale

        protected Locale locale
      • losslessNarrowing

        protected boolean losslessNarrowing
      • preloadSchema

        protected boolean preloadSchema
      • typeLoose

        protected boolean typeLoose
    • Constructor Detail

      • BuilderSupport

        public BuilderSupport()
    • Method Detail

      • 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
      • 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​(String keyword,
                        boolean strict)
      • typeLoose

        public T typeLoose​(boolean typeLoose)