Validator¶
Class Name | Validator |
---|---|
Extends | Logger |
Source | validator.ts |
Examples | validator.spec.ts |
The Validator module can be used to verfiy given JSON schemas.
constructor¶
new Validator(options);
Creates a new Validator instance.
Parameters¶
options
-ValidatorOptions
: options for Validator constructor.schema
-any
: the validation schema definitionlog
-Function
(optional): function to use for logging:(message, level) => {...}
logLevel
-LogLevel
(optional): messages with this level will be logged withlog
logLog
-LogLogInterface
(optional): container for collecting log messageslogLogLevel
-LogLevel
(optional): messages with this level will be pushed tologLog
Returns¶
Validator
instance
isSchemaCorrect¶
Validator.isSchemaCorrect(schema);
Checks if the given ajv schema is correct and returns an array of ajv errors, when the schema is invalid.
Parameters¶
schema
-any
: schema to be validated