Methods
addSchema(JSON)
Add a JSON schema definition to the collection.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
JSON |
Object
|
schema definition. |
Throws:
-
If JSON schema definition does not have an
$id
. - Type
-
Error
compileValidator($id) → {function}
Create a JSON schema validation function for a given schema identified by its
$id
.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
$id |
*
|
$id JSON schema $id .
|
Returns:
- Type:
-
function
JSON schema validation function.
getSchema($id) → {Object}
Get JSON schema definition by its
$id
.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
$id |
string
|
JSON schema $id .
|
Returns:
- Type:
-
Object
JSON schema definition.
removeSchema($id)
Remove a JSON schema definition to the collection.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
$id |
string
|
JSON schema $id .
|
(static) load(rootSchemaDef, resolveDirs)
Create a module:core/schema~SchemaLoader and load all referred JSON schema from the resolve
directories.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
rootSchemaDef |
Object
|
The root JSON schema definition. |
resolveDirs |
Array
|
Additional directories for resolving referred JSON schemas besides the
lib/schema folder in this library. Directory order matters.
|
Throws:
-
Referred schema not found in any of the resolve directories.
- Type
-
Error
Returns:
module:core/schema~SchemaLoader The schema loader with all referred schemas loaded.