Package com.networknt.schema
Class SchemaRegistryConfig
java.lang.Object
com.networknt.schema.SchemaRegistryConfig
Configuration for SchemaRegistry that applies to all the schemas its
validators that is managed by the SchemaRegistry.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder forSchemaRegistryConfig.static classBuilder forSchemaRegistryConfig. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSchemaRegistryConfig(boolean cacheRefs, String errorMessageKeyword, ExecutionContextCustomizer executionContextCustomizer, boolean failFast, Boolean formatAssertionsEnabled, Locale locale, boolean losslessNarrowing, MessageSource messageSource, PathType pathType, boolean preloadSchema, RegularExpressionFactory regularExpressionFactory, SchemaIdValidator schemaIdValidator, Map<String, Boolean> strictness, boolean typeLoose) -
Method Summary
Modifier and TypeMethodDescriptionstatic SchemaRegistryConfig.Builderbuilder()Creates a builder.static SchemaRegistryConfig.Builderbuilder(SchemaRegistryConfig config) Copies values from a configuration to a new builder.Gets the format assertion enabled flag.static SchemaRegistryConfigGets the default config instance.Get the locale to consider when generating localised messages (default is the JVM default).Get the message source to use for generating localised messages.Get the approach used to generate paths in messages, logs and errors.Gets the regular expression factory.Gets the schema id validator to validate $id.booleanGets if schemas loaded from refs will be cached and reused for subsequent runs.booleanbooleanbooleanGets if the schema should be preloaded.booleanAnswers whether a keyword's validators may relax their analysis.booleanDetermines if the validator should perform strict checking.booleanReturns whether types are interpreted in a loose manner.
-
Constructor Details
-
SchemaRegistryConfig
protected SchemaRegistryConfig(boolean cacheRefs, String errorMessageKeyword, ExecutionContextCustomizer executionContextCustomizer, boolean failFast, Boolean formatAssertionsEnabled, Locale locale, boolean losslessNarrowing, MessageSource messageSource, PathType pathType, boolean preloadSchema, RegularExpressionFactory regularExpressionFactory, SchemaIdValidator schemaIdValidator, Map<String, Boolean> strictness, boolean typeLoose)
-
-
Method Details
-
getInstance
Gets the default config instance.- Returns:
- the config
-
getExecutionContextCustomizer
-
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
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
Get the message source to use for generating localised messages.- Returns:
- the message source
-
getPathType
Get the approach used to generate paths in messages, logs and errors.- Returns:
- The path generation approach.
-
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
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
-
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
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
Determines if the validator should perform strict checking.- Parameters:
keyword- the keyworddefaultValue- 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
Creates a builder.- Returns:
- the builder
-
builder
Copies values from a configuration to a new builder.- Parameters:
config- the configuration- Returns:
- the builder
-