validator-ajv
v0.8.4-alpha.3
Published
Ajv validator for @configuration-parsing/core
Downloads
1
Readme
@configuration-parsing/validator-ajv
A joi validator implementing the ValidatableConfiguration
interface of @configuration-parsing/core
.
Install
npm install @configuration-parsing/validator-ajv
Documentation
https://botlfux.github.io/configuration-parsing
Usage
import {JSONSchemaType} from 'ajv'
import {ajvConfigurationValidator} from '@configuration-parsing/validator-ajv'
const configurationSchema: JSONSchemaType<{ foo: string }> = {
type: 'object',
properties: {
foo: {
type: 'string'
}
},
required: [ 'foo' ]
}
const validator = ajvConfigurationValidator(configurationSchema)
const validatedConfiguration = await validator.validate({ foo: 'hello world' })