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()
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 |
|---|---|
void |
applyDefaultValues(JsonArray array)
This function mutates
array applying default values, when available. |
void |
applyDefaultValues(JsonObject object)
This function mutates
object applying default values, when available. |
Object |
getDefaultValue()
Return the default value defined in the schema
|
Object |
getJson()
Get Json representation of the schema
|
JsonPointer |
getScope()
Get scope of this schema
|
boolean |
hasDefaultValue()
Return true if the schema has a default value defined
|
boolean |
isSync()
Returns true if this validator can actually provide a synchronous validation
|
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)
ValidationException if json doesn't match the schema.
Note: If the schema is synchronous, this method will call internally this#validateSync(Object)
json - void validateSync(Object json) throws ValidationException, NoSyncValidationException
ValidationException if json doesn't match the schema.json - ValidationExceptionNoSyncValidationException - If the schema cannot perform a synchronous validationJsonPointer getScope()
Object getJson()
Object getDefaultValue()
boolean hasDefaultValue()
void applyDefaultValues(JsonArray array) throws NoSyncValidationException
array applying default values, when available.array - NoSyncValidationException - if this schema represents a $ref not solved yetvoid applyDefaultValues(JsonObject object) throws NoSyncValidationException
object applying default values, when available.object - NoSyncValidationException - if this schema represents a $ref not solved yetboolean isSync()
Copyright © 2021 Eclipse. All rights reserved.