Package io.vertx.mutiny.json.schema
Class SchemaRepository
java.lang.Object
io.vertx.mutiny.json.schema.SchemaRepository
- All Implemented Interfaces:
MutinyDelegate
A repository is a holder of dereferenced schemas, it can be used to create validator instances for a specific schema.
This is to be used when multiple schema objects compose the global schema to be used for validation.
NOTE: This class has been automatically generated from the original non Mutiny-ified interface.
- Author:
- Paulo Lopes
- See Also:
-
SchemaRepository
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSchemaRepository(io.vertx.json.schema.SchemaRepository delegate) Create a new instance ofSchemaRepositorydelegating to the given (non-null) instance ofSchemaRepository.SchemaRepository(Object delegate) -
Method Summary
Modifier and TypeMethodDescriptionstatic SchemaRepositorycreate(io.vertx.json.schema.JsonSchemaOptions options) Create a repository with some initial configuration.static SchemaRepositorycreate(io.vertx.json.schema.JsonSchemaOptions options, JsonFormatValidator jsonFormatValidator) Create a repository with some initial configuration.dereference(JsonSchema schema) Dereferences a schema to the repository.dereference(String uri, JsonSchema schema) Dereferences a schema to the repository.booleanLook up a schema using a JSON pointer notationio.vertx.json.schema.SchemaRepositoryGet the delegate instance.inthashCode()static SchemaRepositorynewInstance(io.vertx.json.schema.SchemaRepository delegate) Creates a new instance of theSchemaRepository.Preloads the repository with the meta schemas for the related @linkDraftversion.preloadMetaSchema(FileSystem fs, io.vertx.json.schema.Draft draft) Preloads the repository with the meta schemas for the related draft version.io.vertx.core.json.JsonObjectresolve(io.vertx.core.json.JsonObject schema) Resolve all$refin the givenJsonObject.toString()validator(JsonSchema schema) A new validator instance using this repository options.validator(JsonSchema schema, io.vertx.json.schema.JsonSchemaOptions options) A new validator instance overriding this repository options.validator(JsonSchema schema, io.vertx.json.schema.JsonSchemaOptions options, boolean dereference) A new validator instance overriding this repository options.A new validator instance using this repository options.A new validator instance overriding this repository options.
-
Field Details
-
__TYPE_ARG
-
-
Constructor Details
-
SchemaRepository
public SchemaRepository(io.vertx.json.schema.SchemaRepository delegate) Create a new instance ofSchemaRepositorydelegating to the given (non-null) instance ofSchemaRepository. -
SchemaRepository
-
-
Method Details
-
getDelegate
public io.vertx.json.schema.SchemaRepository getDelegate()Get the delegate instance.This method returns the instance on which this shim is delegating the calls. And so, give you access to the bare API.
- Specified by:
getDelegatein interfaceMutinyDelegate- Returns:
- the delegate instance
-
create
Create a repository with some initial configuration.- Parameters:
options- the initial configuration- Returns:
- a repository
-
create
public static SchemaRepository create(io.vertx.json.schema.JsonSchemaOptions options, JsonFormatValidator jsonFormatValidator) Create a repository with some initial configuration.- Parameters:
options- the initial configuration- Returns:
- a repository
-
dereference
Dereferences a schema to the repository.- Parameters:
schema- a new schema to list- Returns:
- a repository
- Throws:
when- a schema is already present for the same idio.vertx.json.schema.SchemaException
-
dereference
public SchemaRepository dereference(String uri, JsonSchema schema) throws io.vertx.json.schema.SchemaException Dereferences a schema to the repository.- Parameters:
uri- the source of the schema used for de-referencing, optionally relative toJsonSchemaOptions.getBaseUri().schema- a new schema to list- Returns:
- a repository
- Throws:
when- a schema is already present for the same idio.vertx.json.schema.SchemaException
-
preloadMetaSchema
Preloads the repository with the meta schemas for the related @linkDraftversion. The related draft version is determined from theJsonSchemaOptions, in case that no draft is set in the options anIllegalStateExceptionis thrown.- Parameters:
fs- The Vert.x file system to load the related schema meta files from classpath- Returns:
- a repository
-
preloadMetaSchema
Preloads the repository with the meta schemas for the related draft version.- Parameters:
fs- The Vert.x file system to load the related schema meta files from classpathdraft- The draft version of the meta files to load- Returns:
- a repository
-
validator
A new validator instance using this repository options.- Parameters:
schema- the start validation schema- Returns:
- the validator
-
validator
A new validator instance using this repository options. This is the preferred way to create a validator as it avoids reparsing schemas and reuses the cache in the repository.- Parameters:
ref- the start validation reference in JSON pointer format- Returns:
- the validator
-
validator
A new validator instance overriding this repository options. This is the preferred way to create a validator as it avoids reparsing schemas and reuses the cache in the repository.- Parameters:
ref- the start validation reference in JSON pointer formatoptions- the options to be using on the validator instance- Returns:
- the validator
-
validator
A new validator instance overriding this repository options. The given schema will not be referenced to the repository.- Parameters:
schema- the start validation schemaoptions- the options to be using on the validator instance- Returns:
- the validator
-
validator
public Validator validator(JsonSchema schema, io.vertx.json.schema.JsonSchemaOptions options, boolean dereference) A new validator instance overriding this repository options.- Parameters:
schema- the start validation schemaoptions- the options to be using on the validator instancedereference- if true the schema will be dereferenced before validation- Returns:
- the validator
-
resolve
public io.vertx.core.json.JsonObject resolve(io.vertx.core.json.JsonObject schema) Resolve all$refin the givenJsonObject. The resolution algrithm is not aware of other specifications. When resolving OpenAPI documents (which only allow$refat 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$refis ignored. This is because$refworks by replacing itself and everything on its level with the definition it is pointing at.- Parameters:
schema- the JSON object to resolve.- Returns:
- a new JSON object with all the
$refreplaced by actual object references. - Throws:
when- the input JSON is not valid.reducing- the JSON pointer to a value is undefined.
-
find
Look up a schema using a JSON pointer notation- Parameters:
pointer- the JSON pointer- Returns:
- the schema
-
newInstance
Creates a new instance of theSchemaRepository. -
hashCode
public int hashCode() -
equals
-
toString
-