Skip to content

socketkit/ajv-semver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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"
    }
  }
}

About

Ajv plugin for validating semantic versions

Resources

Stars

Watchers

Forks

Packages

No packages published