ajv-formats
ajv-formats: JSON Schema Format Validators for Ajv v8+
Repository Health
Technical Analysis
ajv-formats plugs a full set of JSON Schema string format validators into Ajv, the widely used JSON Schema validator for JavaScript and TypeScript. Rather than writing custom regex or ad-hoc checks for values like dates, emails, and UUIDs, developers register this plugin once and get spec-compliant format keyword validation across their whole schema set.
The package ships both a full and a fast validation mode, plus companion comparison keywords (formatMinimum, formatMaximum, and their exclusive variants) for ordering constraints on formatted strings such as dates and times. It has no runtime dependency beyond Ajv itself, making it a lightweight drop-in for any project already validating JSON Schemas.
What You Get
- Over 20 predefined JSON Schema formats: date, time, date-time, duration, uri, uri-reference, uri-template, email, hostname, ipv4, ipv6, regex, uuid, json-pointer, and more
- A
modeoption (“full” or “fast”) to trade strict RFC compliance for faster, simplified regex checks in performance-sensitive paths - Comparison keywords
formatMinimum/formatMaximum/formatExclusiveMinimum/formatExclusiveMaximumfor range constraints on ordered formats like dates and times - A
formats.get()accessor for reusing a single format validator function outside of an Ajv instance - Zero required runtime dependencies beyond Ajv, keeping bundle size and supply-chain surface small
Common Use Cases
- Validating REST or GraphQL API request bodies where fields like
email,date-time, oruuidmust match a precise external format - Enforcing OpenAPI 3.0 data-type formats (
int32,int64,float,double,byte,binary,password) when validating schemas generated from an OpenAPI spec - Adding date/time range checks (e.g. a
startDatemust be before anendDate) using theformatMinimum/formatMaximumkeywords - Selectively whitelisting only a handful of formats (e.g. just
"date"and"time") to keep validation footprint minimal in constrained environments
Under The Hood
Architecture ajv-formats is a single default-export function (formatsPlugin in src/index.ts) that Ajv’s plugin convention calls with an Ajv instance and an options object; it looks up either the fullFormats or fastFormats table exported from src/formats.ts and registers each named format via ajv.addFormat(), optionally also wiring the comparison keywords defined in src/limit.ts. Tech Stack The codebase is a small TypeScript project (three source files, ~430 lines) built with tsc, tested with Jest against the shared JSON-Schema-Test-Suite fixtures, and linted with ESLint/Prettier via the @ajv-validator/config shared config; its only runtime dependency is a peer dependency on ajv itself. Code Quality Tests are thorough for the package’s scope: tests/index.spec.ts, tests/formatLimit.spec.ts, and a json-schema.spec.js runner exercise every format against the official JSON-Schema-Test-Suite submodule, and CI (npm test) chains prettier-check, build, eslint, and coverage before allowing a commit via a Husky pre-commit hook. Code is typed throughout with explicit interfaces (FormatsPlugin, FormatOptions) rather than any. API Design The public surface is intentionally minimal: a single function call (addFormats(ajv, options)) with a well-documented options object supporting an array shorthand or an object form, plus a static .get() accessor for reusing one validator function outside of Ajv. This keeps onboarding friction low but the format-name union type and mode-switching options require reading the README to discover, since types alone don’t convey the RFC-source-per-format nuance.
Used by 25 apps in this directory
GitLab
Developer Tools · Devops
The complete DevOps platform that unifies Git hosting, CI/CD, issue tracking, and security scanning into a single self-hostable application.
Kibana
Analytics · Monitoring
Your open source window into the Elastic Stack — query, visualize, and act on data stored in Elasticsearch with real-time dashboards, AI-assisted search, and automated alerting.
Kimi Code CLI
AI Agents · AI Code Assistants · Developer Tools
A single-binary, terminal-native coding agent that reads, edits, and runs code end to end, built by Moonshot AI for Kimi models but pluggable with Anthropic, OpenAI, and Google providers too.
Langfuse
AI Development · Monitoring
Open source AI engineering platform for LLM observability, prompt management, evaluation, and debugging — self-host in minutes or use Langfuse Cloud.
Lightdash
Analytics · Data Engineering
The open-source Looker alternative that turns your dbt project's metrics and dimensions into governed, self-serve charts and dashboards — no license key required.
Lokus
Knowledge Management · Note Taking
Local-first note-taking with graph view, canvas & AI plugins—your Markdown files, zero telemetry, blazing-fast Rust performance.
nango
Authentication · Automation · Developer Tools
Build product integrations with AI using 800+ APIs — auth, proxy, and TypeScript functions on production-grade infrastructure.
NocoDB
Databases · Low Code Platforms · No Code Platforms
Turn any SQL database into a collaborative no-code spreadsheet with automatic REST APIs and real-time views.
Novu
Developer Tools
Open-source communication infrastructure that connects your products and AI agents to every channel your users live on — Inbox, Email, SMS, Push, Chat, and more.