Class ConfigurationJsonSchemaValidator
java.lang.Object
io.micronaut.jsonschema.configuration.validator.ConfigurationJsonSchemaValidator
- All Implemented Interfaces:
ConfigurationValidator
public final class ConfigurationJsonSchemaValidator
extends Object
implements ConfigurationValidator
Validates Micronaut configuration (
Environment) against JSON schemas on the classpath.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionPatterns used to suppress validation errors.booleanvoidsetFailOnNotPresent(boolean failOnNotPresent) voidsetJsonMapper(@Nullable io.micronaut.json.JsonMapper jsonMapper) voidsetSuppressionPatterns(@Nullable List<String> suppressionPatterns) Set patterns used to suppress validation errors.validate(ClassLoader classLoader, io.micronaut.context.env.Environment environment) Validate the given environment against schemas resolvable from the given classloader.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ConfigurationValidator
validate
-
Constructor Details
-
ConfigurationJsonSchemaValidator
public ConfigurationJsonSchemaValidator()
-
-
Method Details
-
isFailOnNotPresent
public boolean isFailOnNotPresent()- Returns:
- Whether to fail when configuration contains keys not present in schema.
-
setFailOnNotPresent
public void setFailOnNotPresent(boolean failOnNotPresent) - Parameters:
failOnNotPresent- Whether to fail when configuration contains keys not present in schema.
-
setJsonMapper
public void setJsonMapper(@Nullable io.micronaut.json.JsonMapper jsonMapper) - Parameters:
jsonMapper- A mapper used to deserialize JSON schemas.
-
getSuppressionPatterns
-
setSuppressionPatterns
-
validate
public Set<ConfigurationError> validate(ClassLoader classLoader, io.micronaut.context.env.Environment environment) Validate the given environment against schemas resolvable from the given classloader.- Specified by:
validatein interfaceConfigurationValidator- Parameters:
classLoader- The classloader used to discover JSON schemasenvironment- The Micronaut environment- Returns:
- A set of validation errors (empty if valid)
-