There is an alternative method to configure the name andbaseDataPath options via the title property in the schema. For example:
The last word used for the baseDataPath option, other words used for the name option. Based on the example above the name option equals My Loader, the baseDataPath option equals options.
name
Type: Object Default: "Object"
Allow to setup name in validation errors.
baseDataPath
Type: String Default: "configuration"
Allow to setup base data path in validation errors.
postFormatter
Type: Function Default: undefined
Allow to reformat errors.
Examples
schema.json
Loader
Plugin
Allow to disable and enable validation (the validate function do nothing)
This can be useful when you don't want to do validation for production builds.
Also you can enable/disable validation using the process.env.SKIP_VALIDATION env variable.
Supported values (case insensitive):
yes/y/true/1/on
no/n/false/0/off
Contributing
Please take a moment to read our contributing guidelines if you haven't yet done so.
Invalid configuration object. MyPlugin has been initialised using a configuration object that does not match the API schema.
- configuration.optionName should be a integer.
Invalid options object. MyPlugin has been initialised using an options object that does not match the API schema.
- options.optionName should be a integer.
Invalid options object. MyPlugin has been initialized using an options object that does not match the API schema.
- options.optionName should be a integer.
Additional Information.
import { disableValidation, enableValidation, validate } from "schema-utils";
// Disable validation
disableValidation();
// Do nothing
validate(schema, options);
// Enable validation
enableValidation();
// Will throw an error if schema is not valid
validate(schema, options);
// Allow to undestand do you need validation or not
const need = needValidate();
console.log(need);