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(JsonObject schema)
Resolve all
$ref in the given JsonObject . |
default JsonObject |
resolve(JsonSchema schema)
Deprecated.
will be removed in Vert.x 5
|
default JsonObject |
resolve(String ref)
Deprecated.
will be removed in Vert.x 5
|
Validator |
validator(JsonSchema schema)
A new validator instance using this repository options.
|
default Validator |
validator(JsonSchema schema,
JsonSchemaOptions options)
A new validator instance overriding this repository options.
|
Validator |
validator(JsonSchema schema,
JsonSchemaOptions options,
boolean dereference)
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(String ref, JsonSchemaOptions options)
ref
- the start validation reference in JSON pointer formatoptions
- the options to be using on the validator instancedefault Validator validator(JsonSchema schema, JsonSchemaOptions options)
schema
- the start validation schemaoptions
- the options to be using on the validator instanceValidator validator(JsonSchema schema, JsonSchemaOptions options, boolean dereference)
schema
- the start validation schemaoptions
- the options to be using on the validator instancedereference
- if true the schema will be dereferenced before validationJsonObject resolve(JsonObject schema)
$ref
in the given JsonObject
. The resolution algrithm is not aware of other
specifications. When resolving OpenAPI documents (which only allow $ref
at specific locations) you
should validate if the document is valid before performing a resolution.
It is important to note that any sibling elements of a $ref
is ignored. This is because $ref
works by replacing itself and everything on its level with the definition it is pointing at.schema
- the JSON object to resolve.$ref
replaced by actual object references.IllegalArgumentException
- when the input JSON is not valid.UnsupportedOperationException
- reducing the JSON pointer to a value is undefined.default 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.default JsonObject 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.JsonSchema find(String pointer)
pointer
- the JSON pointerCopyright © 2024 Eclipse. All rights reserved.