@socketkit/ajv-locale-code
v1.0.1
Published
Ajv validation for local code strings
Downloads
9
Readme
ajv-locale-code
Adds a locale_code
format to Ajv.
Install
npm i --save @socketkit/ajv-locale-code
Setup
import Ajv from 'ajv'
import localeCode from '@socketkit/ajv-locale-code'
const ajv = new Ajv()
localeCode(ajv)
Usage
When defining your JSON schema, use the format
keyword with ther value set to locale_code
. For example
{
"type": "object",
"properties": {
"locale": {
"type": "string",
"format": "locale_code"
}
}
}