public interface SchemaRepository
This is to be used when multiple schema objects compose the global schema to be used for validation.
Modifier and Type | Method and Description |
---|---|
static SchemaRepository |
create(JsonSchemaOptions options)
Create a repository with some initial configuration.
|
SchemaRepository |
dereference(JsonSchema schema)
Dereferences a schema to the repository.
|
SchemaRepository |
dereference(String uri,
JsonSchema schema)
Dereferences a schema to the repository.
|
JsonSchema |
find(String pointer)
Look up a schema using a JSON pointer notation
|
SchemaRepository |
preloadMetaSchema(FileSystem fs)
Preloads the repository with the meta schemas for the related @link
Draft version. |
SchemaRepository |
preloadMetaSchema(FileSystem fs,
Draft draft)
Preloads the repository with the meta schemas for the related draft version.
|
JsonObject |
resolve(JsonSchema schema)
Tries to resolve all internal and repository local references.
|
JsonObject |
resolve(String ref)
Tries to resolve all internal and repository local references.
|
Validator |
validator(JsonSchema schema)
A new validator instance using this repository options.
|
Validator |
validator(JsonSchema schema,
JsonSchemaOptions options)
A new validator instance overriding this repository options.
|
Validator |
validator(String ref)
A new validator instance using this repository options.
|
Validator |
validator(String ref,
JsonSchemaOptions options)
A new validator instance overriding this repository options.
|
static SchemaRepository create(JsonSchemaOptions options)
options
- the initial configurationSchemaRepository dereference(JsonSchema schema) throws SchemaException
schema
- a new schema to listSchemaException
- when a schema is already present for the same idSchemaRepository dereference(String uri, JsonSchema schema) throws SchemaException
uri
- the source of the schema used for de-referencing, optionally relative to
JsonSchemaOptions.getBaseUri()
.schema
- a new schema to listSchemaException
- when a schema is already present for the same idSchemaRepository preloadMetaSchema(FileSystem fs)
Draft
version. The related draft version
is determined from the JsonSchemaOptions
, in case that no draft is set in the options an
IllegalStateException
is thrown.fs
- The Vert.x file system to load the related schema meta files from classpathSchemaRepository preloadMetaSchema(FileSystem fs, Draft draft)
fs
- The Vert.x file system to load the related schema meta files from classpathdraft
- The draft version of the meta files to loadValidator validator(JsonSchema schema)
schema
- the start validation schemaValidator validator(String ref)
ref
- the start validation reference in JSON pointer formatValidator validator(JsonSchema schema, JsonSchemaOptions options)
schema
- the start validation schemaoptions
- the options to be using on the validator instanceValidator validator(String ref, JsonSchemaOptions options)
ref
- the start validation reference in JSON pointer formatoptions
- the options to be using on the validator instanceJsonObject resolve(JsonSchema schema)
The result is an object where all references have been resolved. Resolution of circular references is shallow. This should normally not be a problem for this use case.
JsonObject
representing the schema with $ref
s replaced by their value.SchemaException
- when the resolution is impossible.JsonObject resolve(String ref)
The result is an object where all references have been resolved. Resolution of circular references is shallow. This should normally not be a problem for this use case.
ref
- the start resolution reference in JSON pointer formatJsonObject
representing the schema with $ref
s replaced by their value.SchemaException
- when the resolution is impossible.JsonSchema find(String pointer)
pointer
- the JSON pointerCopyright © 2023 Eclipse. All rights reserved.