public interface SchemaRouter
It also contains a cache of JsonObject
including on top or inner level some json schemas that could eventually parsed later.
You should not share this object between different threads
Modifier and Type | Method and Description |
---|---|
default SchemaRouter |
addJson(String uri,
JsonObject object)
Add one or more json documents including schemas on top or inner levels.
|
SchemaRouter |
addJson(URI uri,
JsonObject object)
Add one or more json documents including schemas on top or inner levels.
|
SchemaRouter |
addSchema(Schema schema,
JsonPointer... aliasScopes)
Add a parsed schema to this router.
|
SchemaRouter |
addSchemaAlias(Schema schema,
String alias)
Add an alias to a schema already registered in this router (this alias can be solved only from schema scope).
|
SchemaRouter |
addSchemaWithScope(Schema schema,
JsonPointer scope)
Add a parsed schema to this router.
|
static SchemaRouter |
create(Vertx vertx,
HttpClient client,
FileSystem fs,
SchemaRouterOptions schemaRouterOptions)
Create a new
SchemaRouter |
static SchemaRouter |
create(Vertx vertx,
SchemaRouterOptions schemaRouterOptions)
Create a new
SchemaRouter |
List<Schema> |
registeredSchemas() |
Schema |
resolveCachedSchema(JsonPointer refPointer,
JsonPointer schemaScope,
SchemaParser parser)
Resolve cached schema based on refPointer.
|
Future<Schema> |
resolveRef(JsonPointer pointer,
JsonPointer scope,
SchemaParser schemaParser)
Resolve $ref.
|
void |
resolveRef(JsonPointer pointer,
JsonPointer scope,
SchemaParser schemaParser,
Handler<AsyncResult<Schema>> handler)
Like
resolveRef(JsonPointer, JsonPointer, SchemaParser) but with a direct callback. |
Schema resolveCachedSchema(JsonPointer refPointer, JsonPointer schemaScope, SchemaParser parser) throws SchemaException
refPointer
- schemaScope
- parser
- SchemaException
- If was found an unparsed schema that is an invalid json schemavoid resolveRef(JsonPointer pointer, JsonPointer scope, SchemaParser schemaParser, Handler<AsyncResult<Schema>> handler)
resolveRef(JsonPointer, JsonPointer, SchemaParser)
but with a direct callback.Future<Schema> resolveRef(JsonPointer pointer, JsonPointer scope, SchemaParser schemaParser)
SchemaException
or an IllegalArgumentException
pointer
- scope
- schemaParser
- Schema
or failed with a SchemaException
or an IllegalArgumentException
SchemaRouter addSchema(Schema schema, JsonPointer... aliasScopes)
Schema.getScope()
and,
if you provide additional aliasScopes, this method register links to this schema with these scopes.
This method is automatically called by SchemaParser
when a new schema is parsedschema
- schema to addIllegalStateException
- if the schema contains a scope with a relative URI
or one of the aliasScopes has a relative URI
SchemaRouter addSchemaWithScope(Schema schema, JsonPointer scope)
Schema.getScope()
. This may be useful to register links to singleton schemas.
This method is automatically called by SchemaParser
when a new schema is parsedschema
- schema to addIllegalStateException
- if the provided scope contains a relative URI
SchemaRouter addSchemaAlias(Schema schema, String alias)
schema
- schema to addalias
- the schema aliasSchemaRouter addJson(URI uri, JsonObject object)
You can use this schema if you have externally loaded some json document and you want to register to the schema router.
You can later parse and retrieve a schema from this json structure using this#resolveCachedSchema(JsonPointer, JsonPointer, SchemaParser)
,
providing the correct refPointer
uri
- object
- default SchemaRouter addJson(String uri, JsonObject object)
You can use this schema if you have externally loaded some json document and you want to register to the schema router.
You can later parse and retrieve a schema from this json structure using this#resolveCachedSchema(JsonPointer, JsonPointer, SchemaParser)
,
providing the correct refPointer
uri
- object
- static SchemaRouter create(Vertx vertx, SchemaRouterOptions schemaRouterOptions)
SchemaRouter
vertx
- schemaRouterOptions
- static SchemaRouter create(Vertx vertx, HttpClient client, FileSystem fs, SchemaRouterOptions schemaRouterOptions)
SchemaRouter
client
- fs
- schemaRouterOptions
- Copyright © 2022 Eclipse. All rights reserved.