@socketkit/ajv-semver
v1.0.1
Published
Ajv plugin for validating semantic versions
Downloads
6
Readme
ajv-semver
Adds a semver
format to Ajv.
Install
npm i --save @socketkit/ajv-semver
Setup
import Ajv from 'ajv'
import semver from '@socketkit/ajv-semver'
const ajv = new Ajv()
semver(ajv)
Usage
When defining your JSON schema, use the format
keyword with ther value set to semver
. For example
{
"type": "object",
"properties": {
"semver": {
"type": "string",
"format": "semver"
}
}
}