public interface Validator
Modifier and Type | Method and Description |
---|---|
static Validator |
create(JsonSchema schema,
JsonSchemaOptions options)
Creates a new validator with some initial schema and options.
|
static Validator |
create(JsonSchema schema,
JsonSchemaOptions options,
JsonFormatValidator jsonFormatValidator)
Creates a new validator with some initial schema, options and a custom JSON format validator.
|
OutputUnit |
validate(Object instance)
Validate a given input against the initial schema.
|
static Validator create(JsonSchema schema, JsonSchemaOptions options)
When validation is to be reused, it is recommended to create a SchemaRepository
instance and use the
SchemaRepository.validator(String)
} method. The use of a String
key allows avoiding re-parsing
and fast lookups.
schema
- the initial schemaoptions
- the validator optionsstatic Validator create(JsonSchema schema, JsonSchemaOptions options, JsonFormatValidator jsonFormatValidator)
SchemaRepository
instance and use the
SchemaRepository.validator(String)
} method. The use of a String
key allows avoiding re-parsing
and fast lookups.schema
- the initial schemaoptions
- the validator optionsjsonFormatValidator
- the custom JSON format validatorOutputUnit validate(Object instance) throws SchemaException
instance
- instance to validateSchemaException
- if the validation cannot complete, for example when a reference is missing.Copyright © 2024 Eclipse. All rights reserved.