Package io.vertx.reactivex.json.schema
Class SchemaRepository
- java.lang.Object
-
- io.vertx.reactivex.json.schema.SchemaRepository
-
- All Implemented Interfaces:
io.vertx.lang.rx.RxDelegate
public class SchemaRepository extends Object implements io.vertx.lang.rx.RxDelegate
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
originalnon RX-ified interface using Vert.x codegen.
-
-
Field Summary
Fields Modifier and Type Field Description static io.vertx.lang.rx.TypeArg<SchemaRepository>__TYPE_ARG
-
Constructor Summary
Constructors Constructor Description SchemaRepository(SchemaRepository delegate)SchemaRepository(Object delegate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SchemaRepositorycreate(JsonSchemaOptions options)Create a repository with some initial configuration.static SchemaRepositorycreate(JsonSchemaOptions options, JsonFormatValidator jsonFormatValidator)Create a repository with some initial configuration.SchemaRepositorydereference(JsonSchema schema)Dereferences a schema to the repository.SchemaRepositorydereference(String uri, JsonSchema schema)Dereferences a schema to the repository.booleanequals(Object o)JsonSchemafind(String pointer)Look up a schema using a JSON pointer notationSchemaRepositorygetDelegate()inthashCode()static SchemaRepositorynewInstance(SchemaRepository arg)SchemaRepositorypreloadMetaSchema(FileSystem fs)Preloads the repository with the meta schemas for the related @linkDraftversion.SchemaRepositorypreloadMetaSchema(FileSystem fs, Draft draft)Preloads the repository with the meta schemas for the related draft version.JsonObjectresolve(JsonObject schema)Resolve all$refin the given .StringtoString()Validatorvalidator(JsonSchema schema)A new validator instance using this repository options.Validatorvalidator(JsonSchema schema, JsonSchemaOptions options)A new validator instance overriding this repository options.Validatorvalidator(JsonSchema schema, JsonSchemaOptions options, boolean dereference)A new validator instance overriding this repository options.Validatorvalidator(String ref)A new validator instance using this repository options.Validatorvalidator(String ref, JsonSchemaOptions options)A new validator instance overriding this repository options.
-
-
-
Field Detail
-
__TYPE_ARG
public static final io.vertx.lang.rx.TypeArg<SchemaRepository> __TYPE_ARG
-
-
Constructor Detail
-
SchemaRepository
public SchemaRepository(SchemaRepository delegate)
-
SchemaRepository
public SchemaRepository(Object delegate)
-
-
Method Detail
-
getDelegate
public SchemaRepository getDelegate()
- Specified by:
getDelegatein interfaceio.vertx.lang.rx.RxDelegate
-
create
public static SchemaRepository create(JsonSchemaOptions options)
Create a repository with some initial configuration.- Parameters:
options- the initial configuration- Returns:
- a repository
-
create
public static SchemaRepository create(JsonSchemaOptions options, JsonFormatValidator jsonFormatValidator)
Create a repository with some initial configuration.- Parameters:
options- the initial configurationjsonFormatValidator-- Returns:
- a repository
-
dereference
public SchemaRepository dereference(JsonSchema schema)
Dereferences a schema to the repository.- Parameters:
schema- a new schema to list- Returns:
- a repository
-
dereference
public SchemaRepository dereference(String uri, JsonSchema schema)
Dereferences a schema to the repository.- Parameters:
uri- the source of the schema used for de-referencing, optionally relative toJsonSchemaOptions.schema- a new schema to list- Returns:
- a repository
-
preloadMetaSchema
public SchemaRepository preloadMetaSchema(FileSystem fs)
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
public SchemaRepository preloadMetaSchema(FileSystem fs, Draft draft)
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
public Validator validator(JsonSchema schema)
A new validator instance using this repository options.- Parameters:
schema- the start validation schema- Returns:
- the validator
-
validator
public Validator validator(String ref)
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
public Validator validator(String ref, JsonSchemaOptions options)
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
public Validator validator(JsonSchema schema, JsonSchemaOptions options)
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, 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 JsonObject resolve(JsonObject schema)
Resolve all$refin the given . 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.
-
find
public JsonSchema find(String pointer)
Look up a schema using a JSON pointer notation- Parameters:
pointer- the JSON pointer- Returns:
- the schema
-
newInstance
public static SchemaRepository newInstance(SchemaRepository arg)
-
-