@valbo/ajv-strict-formats
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

@valbo/ajv-strict-formats

Stricter versions of JSON Schema formats for Ajv.

npm (scoped) semantic-release Build Status Coverage Status Known Vulnerabilities

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.

Readme

Keywords

Package Sidebar

Install

npm i @valbo/ajv-strict-formats

Weekly Downloads

0

Version

1.0.5

License

MIT

Unpacked Size

21.2 kB

Total Files

27

Last publish

Collaborators

  • valbo