ajv-async
Configure async validation mode in Ajv - JSON-Schema validator
Install
npm install ajv-async
Usage
The code below configures async mode in Ajv instance to use the best async mode (async functions or generators) available in the current environment with/without transpilation. If transpilation is required, you should install nodent or regenerator, ajv-async doesn't install them.
var Ajv = require('ajv');
var setupAsync = require('ajv-async');
var ajv = setupAsync(new Ajv);
async
and/or transpile
options can be passed to Ajv to enable a specific async/transpilation mode. See Ajv docs for more information.
Using in browser
At the moment Ajv already includes nodent and regenerators bundles. You still need to use this package, unless you manually set async
option and explicitely pass processCode
option. transpile
option support requires using this package.
If you build this package with your code with Webpack, it will log warnings because this package uses optional dependencies. To suppress these warnings use IgnorePlugin:
new IgnorePlugin(/regenerator|nodent/, /ajv-async/)
License
MIT