0.1.0 • Published 8 months ago

typebox-formats v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

TypeBox Formats

JSON Schema string formats for TypeBox.

Format validations are from ajv-formats and optional ajv-formats-draft2019.

Installation

npm i typebox-formats
yarn add typebox-formats
pnpm add typebox-formats

Basic Usage

import { FormatRegistry } from '@sinclair/typebox';
import { registerAjvFormats } from 'typebox-formats';

registerAjvFormats(FormatRegistry);

Then TypeBox will validate standard string formats provided by ajv-formats.

import { Type } from '@sinclair/typebox';
import { Value } from '@sinclair/typebox/value';

Value.Check(Type.String({ format: 'date-time' }), '2024-10-27T00:00:00.000Z');
// true
0.1.0

8 months ago