ajv-formats

ajv-formats: JSON Schema Format Validators for Ajv v8+

Library
npm
v3.0.1
228 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
42 /100 Fair
Development Activity 0
Maintenance 32
Community 56
Maturity 60
Momentum 20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
73 /100 Good
Architecture 70
Code Quality 78
Innovation 68
Learning Curve 75

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 mode option (“full” or “fast”) to trade strict RFC compliance for faster, simplified regex checks in performance-sensitive paths
  • Comparison keywords formatMinimum/formatMaximum/formatExclusiveMinimum/formatExclusiveMaximum for 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, or uuid must 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 startDate must be before an endDate) using the formatMinimum/formatMaximum keywords
  • 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

TypeScript
56%
Other

agenta

AI Development · Developer Tools · Devops

4,788

The open-source LLMOps platform unifying prompt engineering, evaluation, and observability for teams building reliable LLM applications.

View details
91
Repo Health
77
Technical
67
Dependency
Built with
TypeScript 56%
Python 39%
Updated 6 days ago
Python
47%
Other

Airbyte

Data Engineering · Developer Tools

22,143

Open-source ELT platform with 600+ connectors for moving data from any source to warehouses, lakes, and AI agents.

View details
95
Repo Health
80
Technical
67
Dependency
Built with
Python 47%
Kotlin 43%
Updated 5 days ago
Rust
86%
Other

Arroyo

Analytics · Data Engineering

5,039

A distributed stream processing engine written in Rust that lets you write SQL to run stateful, real-time computations over data streams with subsecond results.

View details
86
Repo Health
74
Technical
62
Dependency
Built with
Rust 86%
Updated 1 weeks ago
JavaScript
100%
Other

Automatisch

Automation · No Code Platforms

13,979

Self-hosted, no-code workflow automation that keeps your data on your own servers—a privacy-first alternative to Zapier with 90+ integrations.

View details
49
Repo Health
78
Technical
62
Dependency
Built with
JavaScript 100%
Updated 7 months ago
TypeScript
100%
MIT

Botpress

AI Assistants · AI Development · Customer Support

14,924

The open-source hub for building and deploying LLM-powered AI agents with TypeScript-first tooling, 40+ integrations, and a revolutionary code-execution agent framework.

View details
94
Repo Health
82
Technical
64
Dependency
Built with
TypeScript 100%
Updated 1 weeks ago
Ruby
50%
Other

Chatwoot

Customer Support

37,254

Open-source omnichannel customer support platform with AI-powered agents, live chat, and self-hosting — a full Intercom and Zendesk alternative.

View details
95
Repo Health
78
Technical
69
Dependency
Built with
Ruby 50%
Vue 25%
JavaScript 22%
Updated 6 days ago
TypeScript
92%
MIT

Dittofeed

Automation · Marketing

2,968

Open-source omni-channel customer engagement platform for automating transactional and marketing messages via email, SMS, WhatsApp, Slack, and mobile push.

View details
54
Repo Health
75
Technical
62
Dependency
Built with
TypeScript 92%
Updated 6 months ago
TypeScript
75%
Apache 2.0

Fern

Developer Tools

3,787

Fern turns a single OpenAPI, AsyncAPI, or Protobuf definition into type-safe SDKs for nine languages and a hosted API documentation site, all from one CLI and one source of truth.

View details
90
Repo Health
86
Technical
66
Dependency
Built with
TypeScript 75%
Updated 5 days ago
TypeScript
73%
AGPL 3.0

Firecrawl

AI Development · Developer Tools

185,614

Turn any website into clean, LLM-ready data with a single API call — no proxy headaches, no scraping complexity.

View details
89
Repo Health
83
Technical
65
Dependency
Built with
TypeScript 73%
Python 13%
Updated 5 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers