Ajv validation plugin.
npm i @qiwi/uniconfig-plugin-ajv
yarn add @qiwi/uniconfig-plugin-ajv
import uniconfig, {rollupPlugin} from '@qiwi/uniconfig-core'
import uniconfigPluginAjv from '@qiwi/uniconfig-plugin-ajv'
rollupPlugin(uniconfigPluginAjv)
const config = uniconfig({
data: {
data: {
foo: 'bar'
},
schema: {
type: 'object',
required: ['foo'],
properties: {
foo: {
type: 'string',
minLength: 1
}
}
}
},
pipeline: 'ajv',
mode: 'sync'
})
config.get('foo') // 'bar'