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 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

      public List<String> getSuppressionPatterns()
      Patterns used to suppress validation errors. Matching errors are downgraded to warnings.
      Returns:
      The suppression patterns
    • setSuppressionPatterns

      public void setSuppressionPatterns(@Nullable List<String> suppressionPatterns)
      Set patterns used to suppress validation errors. Matching errors are downgraded to warnings. Patterns may include * wildcards (for example micronaut.http.*).
      Parameters:
      suppressionPatterns - The suppression patterns
    • 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:
      validate in interface ConfigurationValidator
      Parameters:
      classLoader - The classloader used to discover JSON schemas
      environment - The Micronaut environment
      Returns:
      A set of validation errors (empty if valid)