1.0.1 • Published 4 years ago

@socketkit/ajv-uuid v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

ajv-uuid

Adds a uuid format to Ajv.

Install

npm i --save @socketkit/ajv-uuid

Setup

import Ajv from 'ajv'
import base64 from '@socketkit/ajv-base64'
const ajv = new Ajv()
base64(ajv)

Usage

When defining your JSON schema, use the format keyword with ther value set to uuid. For example

{
  "type": "object",
  "properties": {
    "uuid": {
      "type": "string",
      "format": "uuid"
    }
  }
}