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 TypeMethodDescription<T> @NonNull Set<? extends ValidationMessage>Validate Object based on types JSON schema.Set<? extends ValidationMessage>Validate Object against a JSON schema.Set<? extends ValidationMessage>Validate Object against a JSON schema.<T> @NonNull Set<? extends ValidationMessage>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 validatetype- 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 schematype- 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
Set<? extends ValidationMessage> validate(@NonNull @NonNull Object value, @NonNull @NonNull Map<String, Object> jsonSchema) throws IOExceptionValidate Object against a JSON schema.- Parameters:
value- Object to validate against a JSON schemajsonSchema- The JSON Schema expressed as a Map- Returns:
- A set of validation messages. Empty if valid.
- Throws:
IOException- If an error occurs validating the JSON against the schema.
-
validate
Set<? extends ValidationMessage> validate(@NonNull @NonNull Object value, @NonNull @NonNull String jsonSchema) throws IOException Validate Object against a JSON schema.- Parameters:
value- Object to validate against a JSON schemajsonSchema- The JSON Schema expressed as a Map- Returns:
- A set of validation messages. Empty if valid.
- Throws:
IOException- If an error occurs validating the JSON against the schema.
-