@valbo/ajv-strict-formats
v1.0.5
Published
Stricter versions of JSON Schema formats for Ajv
Downloads
2
Readme
@valbo/ajv-strict-formats
Stricter versions of JSON Schema formats for Ajv.
Install
npm install @valbo/ajv-strict-formats
Usage
Adds time, date-time and uuid formats to Ajv that are stricter than the ones from the ajv-formats package:
import Ajv from 'ajv';
import addFormats from '@valbo/ajv-strict-formats';
const ajv = new Ajv();
addFormats(ajv);
Or add only some formats:
import Ajv from 'ajv';
import addFormats from '@valbo/ajv-strict-formats';
const ajv = new Ajv();
addFormats(ajv, ['date-time', 'uuid']);
time format
A stricter format that only accepts HH:mm:ss with no fractions of seconds or timezone.
date-time format
A stricter format that only accepts T as a separator and Z as the timezone: 2021-02-13T22:04:00Z
Fractions of seconds are allowed: 2021-02-13T22:04:00.000Z
uuid format
A stricter format that only allows lowercase characters.