public class SchemaRouterImpl extends Object implements SchemaRouter
Constructor and Description |
---|
SchemaRouterImpl(Vertx vertx,
HttpClient client,
FileSystem fs,
SchemaRouterOptions options) |
Modifier and Type | Method and Description |
---|---|
SchemaRouter |
addJson(URI uri,
JsonObject object)
Add one or more json documents including schemas on top or inner levels.
|
SchemaRouter |
addSchema(Schema schema,
JsonPointer... aliasScope)
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.
|
void |
insertRouterNode(JsonPointer pointer,
io.vertx.json.schema.common.RouterNode nodeToWrite) |
void |
insertSchema(JsonPointer pointer,
io.vertx.json.schema.common.RouterNode initialNode,
Schema schema) |
List<Schema> |
registeredSchemas() |
Future<Void> |
resolveAllSchemas() |
Schema |
resolveCachedSchema(JsonPointer refPointer,
JsonPointer scope,
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
SchemaRouter.resolveRef(JsonPointer, JsonPointer, SchemaParser) but with a direct callback. |
Future<Schema> |
solveAllSchemaReferences(Schema schema)
Deeply resolve all references of the provided
schema |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addJson, create, create
public SchemaRouterImpl(Vertx vertx, HttpClient client, FileSystem fs, SchemaRouterOptions options)
public List<Schema> registeredSchemas()
registeredSchemas
in interface SchemaRouter
public Schema resolveCachedSchema(JsonPointer refPointer, JsonPointer scope, SchemaParser parser)
SchemaRouter
resolveCachedSchema
in interface SchemaRouter
public void resolveRef(JsonPointer pointer, JsonPointer scope, SchemaParser schemaParser, Handler<AsyncResult<Schema>> handler)
SchemaRouter
SchemaRouter.resolveRef(JsonPointer, JsonPointer, SchemaParser)
but with a direct callback.resolveRef
in interface SchemaRouter
public Future<Schema> resolveRef(JsonPointer pointer, JsonPointer scope, SchemaParser schemaParser)
SchemaRouter
SchemaException
or an IllegalArgumentException
resolveRef
in interface SchemaRouter
Schema
or failed with a SchemaException
or an IllegalArgumentException
public SchemaRouter addSchema(Schema schema, JsonPointer... aliasScope)
SchemaRouter
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 parsedaddSchema
in interface SchemaRouter
schema
- schema to addpublic SchemaRouter addSchemaWithScope(Schema schema, JsonPointer scope)
SchemaRouter
Schema.getScope()
. This may be useful to register links to singleton schemas.
This method is automatically called by SchemaParser
when a new schema is parsedaddSchemaWithScope
in interface SchemaRouter
schema
- schema to addpublic SchemaRouter addSchemaAlias(Schema schema, String alias)
SchemaRouter
addSchemaAlias
in interface SchemaRouter
schema
- schema to addalias
- the schema aliaspublic SchemaRouter addJson(URI uri, JsonObject object)
SchemaRouter
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
addJson
in interface SchemaRouter
public Future<Schema> solveAllSchemaReferences(Schema schema)
schema
schema
- public void insertSchema(JsonPointer pointer, io.vertx.json.schema.common.RouterNode initialNode, Schema schema)
public void insertRouterNode(JsonPointer pointer, io.vertx.json.schema.common.RouterNode nodeToWrite)
Copyright © 2022 Eclipse. All rights reserved.