Interface JsonSchemaValidator


@DefaultImplementation(io.micronaut.jsonschema.validation.DefaultJsonSchemaValidator.class) public interface JsonSchemaValidator
JSON Schema Validator. It is configurable with JsonSchemaValidatorConfiguration.
Since:
1.0.0
Author:
Sergio del Amo
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> @NonNull Set<? extends ValidationMessage>
    validate(@NonNull Object value, @NonNull Class<T> type)
    Validate Object based on types JSON schema.
    <T> @NonNull Set<? extends ValidationMessage>
    validate(@NonNull String value, @NonNull Class<T> type)
    Validate JSON based on a types JSON schema.
  • Method Details

    • validate

      @NonNull <T> @NonNull Set<? extends ValidationMessage> validate(@NonNull @NonNull String value, @NonNull @NonNull Class<T> type) throws IOException
      Validate JSON based on a types JSON schema.
      Type Parameters:
      T - Type used to generate the JSON Schema
      Parameters:
      value - JSON value to validate
      type - The type used to generate the JSON Schema
      Returns:
      A set of validation messages. Empty if valid.
      Throws:
      IOException - If an error occurs validating the JSON against the schema.
    • validate

      @NonNull <T> @NonNull Set<? extends ValidationMessage> validate(@NonNull @NonNull Object value, @NonNull @NonNull Class<T> type) throws IOException
      Validate Object based on types JSON schema.
      Type Parameters:
      T - Type used to generate the JSON Schema
      Parameters:
      value - Object to validate against a JSON schema
      type - The type used to generate the JSON Schema
      Returns:
      A set of validation messages. Empty if valid.
      Throws:
      IOException - If an error occurs validating the JSON against the schema.