-
Notifications
You must be signed in to change notification settings - Fork 57
Schema loading
Define a coherent loading strategy and matching API.
Use a set of options for loading schemas according to the user's need.
- Have "anonymous", rootless schemas.
- Preload schemas at absolute JSON References only (URI has a scheme; no fragment or an empty fragment).
- Give the possibility to use the top level "id" only if absolute and the schema is not loaded via a URI.
- Enable or disable caching.
- Give the possibility to use inline dereferencing.
Proposed name: interface SchemaLoadingOption
; implementation: DefaultSchemaLoadingOption.*
If a schema is loaded anonymously, and a top level "id" is found is a valid, absolute JSON Reference, then the schema is loaded in cache using that URI.
If the schema redefines the context by using embedded "id"s, then the schema is authoritative for that URI context as soon as the validation process stays within this schema. Otherwise the normal loading procedure takes place.
If this option is defined, schemas will not be cached and will be reloaded each time.
If a schema is preloaded using a URI but the schema has an absolute, valid JSON Reference at top level, and this URI differs from the request URI, an unchecked exception is raised.
If a load request for a URI which is not a valid JSON Reference (that is, its fragment part, if any, is not a JSON Pointer), the load request fails with an unchecked exception.
Abstract class (or interface?). Methods:
-
load(JsonNode)
: load a schema anonymously; -
preload(URI, JsonNode)
: preload a schema at a given URI; -
load(URI)
: load a schema at a given URI; possibly a reference, and possibly with a fragment part.
Inside a JsonSchemaLoader
. Takes care of namespace/schema redirections etc.
Within, and uses, a JsonSchemaLoader
. Is in charge of full JSON Reference resolution, conflict detection etc.
ni: URI: neat, but expensive.