{
 "kind": "tool",
 "slug": "ajv-formats",
 "path": "tools/ajv-formats/",
 "name": "ajv-formats",
 "maker": null,
 "density": "full",
 "crumbs": [
  [
   "Tools",
   "tools/"
  ],
  [
   "Forms, validation and schemas",
   "tools/forms-validation/"
  ]
 ],
 "lead": "Check emails, dates and links in form data.",
 "chips": [
  {
   "label": "Forms, validation and schemas",
   "path": "tools/forms-validation/"
  },
  {
   "label": "NPM"
  }
 ],
 "primary": {
  "label": "Copy install command",
  "copy": "npm install ajv-formats"
 },
 "links": [
  {
   "label": "GitHub",
   "href": "https://github.com/ajv-validator/ajv-formats"
  },
  {
   "label": "Website",
   "href": "https://github.com/ajv-validator/ajv-formats#readme"
  }
 ],
 "track": "New versions, deprecation and license changes on your dashboard",
 "verdicts": [
  {
   "key": "license",
   "label": "License",
   "value": "MIT",
   "status": "yes",
   "sub": "Use it in paid apps",
   "quote": "to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software",
   "note": "MIT allows use in paid and closed products.",
   "src": "https://github.com/ajv-validator/ajv-formats/blob/master/LICENSE"
  },
  {
   "key": "maint",
   "label": "Maintained",
   "value": "Quiet for a year",
   "status": "cond",
   "sub": "Last change Aug 18, 2024",
   "note": "Latest GitHub release Aug 14, 2021. ",
   "src": "https://github.com/ajv-validator/ajv-formats"
  },
  {
   "key": "pop",
   "label": "Used by agents' projects",
   "value": "58 projects",
   "status": "info",
   "sub": "#7 of 63 in its category",
   "note": "Dependency in 58 public GitHub projects set up for AI coding agents that we scanned (0.9%).",
   "src": null
  },
  {
   "key": "agent",
   "label": "Agent access",
   "value": "Install only",
   "status": "info",
   "sub": null,
   "note": "Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.",
   "src": null
  }
 ],
 "vfoot": "From the package registry and GitHub, checked daily; card checked Nov 11, 2026.",
 "blocks": [
  {
   "id": "overview",
   "nav": "Overview",
   "h2": "What ajv-formats does",
   "parts": [
    {
     "t": "prose",
     "text": "ajv-formats is a small free add-on for Ajv, a JavaScript library that checks data against a written set of rules called a JSON Schema. Without it, Ajv cannot check rules such as \"this must be an email\" or \"this must be a date\". With it, your app can reject a bad email, an impossible date or a broken link before saving a form."
    },
    {
     "t": "h3",
     "text": "What people build with it"
    },
    {
     "t": "uses",
     "items": [
      {
       "title": "Check sign-up and contact forms",
       "text": "Your server checks that the email, the website address and the date a person typed have the right shape before it saves them.",
       "idea": false
      },
      {
       "title": "Refuse bookings in the past",
       "text": "A booking form accepts only dates from today on, and the same schema gives the error text to show next to the field.",
       "idea": false
      },
      {
       "title": "Check data from an AI model",
       "text": "When a language model returns structured answers, your code checks that the dates, links and IDs in them are well formed before using them.",
       "idea": true
      },
      {
       "title": "Match OpenAPI number and data types",
       "text": "If your service is described with OpenAPI, the same checks for 32-bit and 64-bit whole numbers and base64 data run on incoming requests.",
       "idea": false
      },
      {
       "title": "Check server settings files",
       "text": "Before a deploy, a script checks that every host name, IP address and link in a settings file is written correctly.",
       "idea": true
      }
     ]
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "ajv-formats popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "59",
       "of": "/ 100",
       "l": "Gid Score, #1071 overall"
      },
      {
       "n": "217M",
       "l": "downloads a week, npm"
      },
      {
       "n": "229",
       "l": "GitHub stars"
      },
      {
       "n": "58",
       "l": "agent projects use it"
      }
     ]
    },
    {
     "t": "small",
     "text": "Gid Score measures public popularity and activity, not quality.",
     "link": "How the Gid Score is calculated",
     "path": "tools/top/"
    }
   ]
  },
  {
   "id": "usage",
   "nav": "How it is used",
   "h2": "How ajv-formats is used",
   "parts": [
    {
     "t": "list",
     "items": [
      "ajv-formats is a dependency in 58 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (1.2% of the 4,867 JavaScript/TypeScript ones), #7 of 63 in forms, validation and schemas.",
      "Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 119; those are left out of every share on this page.",
      "Projects that use it most often also use Ajv (100.0%), jsdom (53.4%), js-yaml (36.2%).",
      "It is more common in projects set up for Kiro (5.7%) than for Cursor (0.7%)."
     ]
    },
    {
     "t": "h3",
     "text": "By coding agent"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "36 projects, 1.2%",
       "v": "GitHub Copilot",
       "path": "agents/github-copilot/"
      },
      {
       "l": "34 projects, 1.0%",
       "v": "Claude Code",
       "path": "agents/claude-code/"
      },
      {
       "l": "16 projects, 0.7%",
       "v": "Cursor",
       "path": "agents/cursor/"
      },
      {
       "l": "11 projects, 2.3%",
       "v": "Gemini CLI",
       "path": "agents/gemini-cli/"
      },
      {
       "l": "8 projects, 5.7%",
       "v": "Kiro",
       "path": "agents/kiro/"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Often used with"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In 100.0% of its projects",
       "v": "Ajv",
       "path": "tools/ajv/"
      },
      {
       "l": "In 53.4% of its projects",
       "v": "jsdom",
       "path": "tools/jsdom/"
      },
      {
       "l": "In 36.2% of its projects",
       "v": "js-yaml",
       "path": "tools/js-yaml/"
      },
      {
       "l": "In 51.7% of its projects",
       "v": "Prettier",
       "path": "tools/prettier/"
      },
      {
       "l": "In 31.0% of its projects",
       "v": "uuid",
       "path": "tools/uuid/"
      },
      {
       "l": "In 31.0% of its projects",
       "v": "fast-xml-parser",
       "path": "tools/fast-xml-parser/"
      },
      {
       "l": "In 31.0% of its projects",
       "v": "markdownlint-cli2",
       "path": "tools/markdownlint-cli2/"
      },
      {
       "l": "In 29.3% of its projects",
       "v": "Lefthook",
       "path": "tools/lefthook/"
      }
     ]
    }
   ]
  },
  {
   "id": "more",
   "nav": null,
   "spy_as": "usage",
   "h2": "More about ajv-formats",
   "parts": [
    {
     "t": "more",
     "items": [
      {
       "title": "Funding",
       "path": "tools/funding/",
       "items": [
        "GitHub Sponsors: https://github.com/epoberezkin",
        "Open Collective: https://opencollective.com/ajv",
        "15 GitHub sponsors"
       ]
      },
      {
       "title": "More in Forms, validation and schemas",
       "path": "tools/forms-validation/",
       "items": [
        {
         "text": "Zod",
         "path": "tools/zod/"
        },
        {
         "text": "React Hook Form",
         "path": "tools/react-hook-form/"
        },
        {
         "text": "Pydantic",
         "path": "tools/pydantic/"
        },
        {
         "text": "React Hook Form Resolvers",
         "path": "tools/hookform/"
        },
        {
         "text": "Ajv",
         "path": "tools/ajv/"
        },
        {
         "text": "jsonschema",
         "path": "tools/jsonschema/"
        },
        {
         "text": "zod-to-json-schema",
         "path": "tools/zod-to-json-schema/"
        },
        {
         "text": "Protocol Buffers",
         "path": "tools/protobuf/"
        }
       ]
      }
     ]
    }
   ]
  },
  {
   "id": "alternatives",
   "nav": "Alternatives",
   "h2": "Alternatives",
   "parts": [
    {
     "t": "alts",
     "items": [
      {
       "name": "ajv-formats",
       "me": true,
       "facts": [
        "MIT",
        "Gid 59",
        "217M/wk"
       ]
      },
      {
       "name": "Zod",
       "why": "Pick Zod when you write your rules in TypeScript code rather than as JSON Schema and want the types to follow from them.",
       "path": "tools/zod/",
       "facts": []
      },
      {
       "name": "Validator.js",
       "why": "Pick Validator.js when you only need to check single strings, such as one email or URL, without a schema.",
       "path": "tools/validator/",
       "facts": []
      },
      {
       "name": "jsonschema",
       "why": "Pick jsonschema when your server is written in Python rather than JavaScript.",
       "path": "tools/jsonschema/",
       "facts": []
      }
     ],
     "more": "Compare ajv-formats with another tool",
     "more_path": "tools/compare/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "prompt",
     "text": "Validate the booking form on the server with ajv 8.20.0 and ajv-formats 3.0.1 (call addFormats(ajv) with no options), using format email, uri and date plus formatMinimum set to today, and return each error message next to its field."
    },
    {
     "t": "steps",
     "items": [
      {
       "text": "Install Ajv and the formats add-on in your JavaScript project.",
       "code": "npm install ajv ajv-formats",
       "src": "https://github.com/ajv-validator/ajv-formats/blob/master/README.md"
      },
      {
       "text": "Create Ajv and add the formats to it.",
       "code": "// ESM/TypeScript import\nimport Ajv from \"ajv\"\nimport addFormats from \"ajv-formats\"\n// Node.js require:\nconst Ajv = require(\"ajv\")\nconst addFormats = require(\"ajv-formats\")\n\nconst ajv = new Ajv()\naddFormats(ajv)\n",
       "src": "https://github.com/ajv-validator/ajv-formats/blob/master/README.md"
      },
      {
       "text": "To add only some formats, pass their names.",
       "code": "addFormats(ajv, [\"date\", \"time\"])",
       "src": "https://github.com/ajv-validator/ajv-formats/blob/master/README.md"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Mistakes to avoid"
    },
    {
     "t": "mistakes",
     "items": [
      {
       "dont": "new Ajv().compile({ type: \"string\", format: \"email\" }) without ajv-formats, or strict: false to silence the error",
       "fix": "Call addFormats(ajv) once on the Ajv instance before compiling schemas that use format",
       "why": "Ajv 7 and newer ship without the formats, and strict: false just skips the format check silently."
      },
      {
       "dont": "addFormats(ajv, { mode: \"fast\" }) with formatMinimum in the schema",
       "fix": "addFormats(ajv, { mode: \"fast\", keywords: true }), or addFormats(ajv) with no options",
       "why": "With an options object the comparison keywords are added only when keywords is true; in our run Ajv then threw \"strict mode: unknown keyword: formatMinimum\"."
      },
      {
       "dont": "Choosing mode \"fast\" and trusting it to reject impossible dates",
       "fix": "Keep the default full mode when the calendar date must be real",
       "why": "Fast mode checks only the shape; in our run \"2026-02-30\" passed the date format in fast mode and failed in full mode."
      },
      {
       "dont": "format: \"url\" in new schemas",
       "fix": "format: \"uri\" (or \"uri-reference\" for relative links)",
       "why": "The url format is marked deprecated in the format list."
      },
      {
       "dont": "Upgrading ajv in your app and building standalone validation code while ajv-formats still pulls an older ajv",
       "fix": "Make sure one ajv version is installed (check the lockfile, or reinstall cleanly)",
       "why": "Standalone code checks that ajv-formats uses the same ajv as your app."
      }
     ]
    }
   ]
  },
  {
   "id": "faq",
   "nav": "Questions",
   "h2": "Questions",
   "parts": [
    {
     "t": "faq",
     "items": [
      {
       "q": "Why does Ajv say \"unknown format\" for my schema?",
       "a": "Since version 7, Ajv no longer includes the formats; add ajv-formats, or Ajv in strict mode stops at the unknown format.",
       "evidence": {
        "url": "https://github.com/ajv-validator/ajv-formats/blob/master/README.md",
        "quote": "when ajv encounters an undefined format it throws exception (unless ajv instance was configured with strict: false option)."
       }
      },
      {
       "q": "Which formats does it add?",
       "a": "Dates and times, durations, URIs, email, host names, IPv4 and IPv6, regular expressions, UUIDs, JSON pointers and the OpenAPI number and data types.",
       "evidence": {
        "url": "https://github.com/ajv-validator/ajv-formats/blob/master/README.md",
        "quote": "The package defines these formats:"
       }
      },
      {
       "q": "What is the difference between the \"full\" and \"fast\" modes?",
       "a": "Full is the default. Fast uses simpler patterns and does not check date and time ranges, so February 30 passed in our run.",
       "evidence": {
        "url": "https://github.com/ajv-validator/ajv-formats/blob/master/README.md",
        "quote": "For example, \"date\", \"time\" and \"date-time\" do not validate ranges in \"fast\" mode, only string structure, and other formats have simplified regular expressions."
       }
      },
      {
       "q": "Can I use it in a paid product?",
       "a": "Yes, it is under the MIT license; keep its notice with copies of the code.",
       "evidence": {
        "url": "https://github.com/ajv-validator/ajv-formats/blob/master/LICENSE",
        "quote": "The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software."
       }
      }
     ]
    }
   ]
  }
 ],
 "glance": [
  [
   "Package",
   "npm ajv-formats"
  ],
  [
   "Category",
   "Forms, validation and schemas"
  ],
  [
   "License",
   "MIT"
  ],
  [
   "Gid Score",
   "59.4"
  ],
  [
   "Rank in category",
   "#7 of 63"
  ],
  [
   "GitHub",
   "ajv-validator/ajv-formats"
  ],
  [
   "Last change",
   "Aug 18, 2024"
  ]
 ],
 "good": [
  "It only works together with Ajv version 8; it is not a checker on its own.",
  "The newest release, 3.0.1, came out on 2024-03-30 and nothing has been released since. In our run it still worked with Ajv 8.20.0.",
  "Ajv's docs advise against format checks on data from strangers unless you review them, because some patterns can be made to run very slowly."
 ],
 "checked_line": "Read by AgentGid from 6 official pages, card checked Nov 11, 2026; numbers update daily.",
 "logo": "https://agentgid.com/media/avatars/ajv-validator.png"
}