typebox-formats
v0.1.0
Published
JSON Schema string formats for TypeBox.
Downloads
80
Readme
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