public interface Schema
A schema could have two states:
this#validateSync(Object) and this#validateAsync(Object)this#validateAsync(Object) to validate your json. If you use this#validateSync(Object) it will throw a NoSyncValidationException
To check the schema state you can use method this#isSync(). Note that invoking validateAsync(Object) generally doesn't have any additional overhead than invoking validateSync(Object).
The schema can mutate the state in time, e.g. if you have a schema that is asynchronous because of a $ref,
after the first validation the external schema is cached inside SchemaRouter and this schema will switch to synchronous state
| Modifier and Type | Method and Description |
|---|---|
Object |
getJson() |
JsonPointer |
getScope() |
boolean |
isSync() |
Future<Void> |
validateAsync(Object json)
Validate the json performing an asynchronous validation.
|
void |
validateSync(Object json)
Validate the json performing a synchronous validation.
|
Future<Void> validateAsync(Object json)
Note: If the schema is synchronous, this method will call internally this#validateSync(Object)
json - input to validateValidationException if json doesn't match the schema, otherwise a succeeded future.void validateSync(Object json) throws ValidationException, NoSyncValidationException
ValidationException if json doesn't match the schema.json - input to validateValidationException - if the input doesn't match the schemaNoSyncValidationException - If the schema cannot perform a synchronous validationJsonPointer getScope()
Object getJson()
boolean isSync()
Copyright © 2022 Eclipse. All rights reserved.