Skip to content

Latest commit

 

History

History
39 lines (33 loc) · 693 Bytes

File metadata and controls

39 lines (33 loc) · 693 Bytes

@qiwi/uniconfig-plugin-ajv

Ajv validation plugin.

Install

  npm i @qiwi/uniconfig-plugin-ajv
  yarn add @qiwi/uniconfig-plugin-ajv

Usage

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'