JAEGIS-METHOD-v2.0\v2.1.1\JAEGIS\JAEGIS_Core\JAEGIS-METHOD\node_modules\schema-utils\README

npm node tests coverage GitHub Discussions size

schema-utils

Package for validate options in loaders and plugins.

Getting Started

To begin, you'll need to install schema-utils:

npm install schema-utils

API

schema.json

{
  "type": "object",
  "properties": {
    "option": {
      "type": "boolean"
    }
  },
  "additionalProperties": false
}

schema

Type: String

JSON schema.

Simple example of schema:

options

Type: Object

Object with options.

configuration

Allow to configure validator.

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.

CONTRIBUTING

License

MIT

Last updated