{"name":"ajv-formats","version":"0.3.2","description":"Format validation for Ajv v7 (WIP)","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc","prettier:write":"prettier --write './**/*.{md,json,yaml,js,ts}'","prettier:check":"prettier --list-different './**/*.{md,json,yaml,js,ts}'","eslint":"eslint --ext .ts ./src/**/*","test-spec":"jest","test":"npm run prettier:check && npm run build && npm run eslint && npm run test-spec","ci-test":"npm run prettier:check && npm run eslint && npm run build && npm run test"},"repository":{"type":"git","url":"git+https://github.com/ajv-validator/ajv-formats.git"},"keywords":["Ajv","JSON-Schema","format","validation"],"author":{"name":"Evgeny Poberezkin"},"license":"MIT","bugs":{"url":"https://github.com/ajv-validator/ajv-formats/issues"},"homepage":"https://github.com/ajv-validator/ajv-formats#readme","dependencies":{"ajv":"^7.0.0-alpha.1"},"devDependencies":{"@ajv-validator/config":"^0.2.3","@types/jest":"^26.0.5","@types/node":"^14.10.1","@typescript-eslint/eslint-plugin":"^3.7.0","@typescript-eslint/parser":"^3.7.0","ajv":"^7.0.0-alpha.1","eslint":"^7.5.0","eslint-config-prettier":"^6.11.0","husky":"^4.2.5","jest":"^26.1.0","json-schema-test":"^2.0.0","lint-staged":"^10.2.11","prettier":"^2.0.5","ts-jest":"^26.1.3","typescript":"^3.9.7"},"prettier":"@ajv-validator/config/prettierrc.json","husky":{"hooks":{"pre-commit":"lint-staged && npm test"}},"lint-staged":{"*.{md,json,yaml,js,ts}":"prettier --write"},"gitHead":"103e3bac841aeeaf2fc4e64de5296344a461deec","_id":"ajv-formats@0.3.2","_nodeVersion":"14.9.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-k7ki1CboXZdaBLzoEunIcwjYt+IldJL/g3pt+8p/IcvhPiE5CFYVSle/ixyXWcFmhOQ4ItnmS7Im+4uDRqYcNQ==","shasum":"c581118f2ec8e5f943411e7b6234343cc64c81a7","tarball":"http://registry-npm.ywwl.com/ajv-formats/download/ajv-formats-0.3.2.tgz","fileCount":292,"unpackedSize":1041362,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfYh4pCRA9TVsSAnZWagAAMRoQAKHSHuNJ//DHH50xrWNr\nISMzXRIqEfHvMUayZ5uwiniGa8CEh030pfaGS2FtvcM3TwgnQcPDZZZDhpdz\nbSU2imudxcvBbqDGtSZdIKlF1LHq0Xjs+RxmzQu43z31FEq2Y0HKSQbXpDuA\nSshfgDm/lte5WbaaI0rekWlrWmUP7rCAsWjYsZALHnyxHlIqQ6YzZMylsqqG\nvCD1gd+1U2klZJaIoAm3hJfWuFtbGwLIWqQAIQLVRbz9HhMApJ4vZohB4w8W\nNoAViruWKpaK7Nbqt5Pn+nxC6vkFiTnoDbRy/J4vN3WnSCZR586uaJg9+h3u\n+Do8ZBnJrK6x+YhpMwqm/41SN/pvplO3Gumvgeoc8PhYCn6VW36/OYE7VGlW\neIe7QR2yKGM+9xDtpiYi1AY8yGdQzJdTifkxyEE2Ir0ebnU5ITMCiJpBPVHq\ntnTvJktmMSUNOYh8Q4lNw4RASh1X2tPSzGvZ5fR92BH9y0lQp3ZGG9qMWhbU\nG96p/SegW+SMRxSD9E35KlsICZj0bJLfr2fZ4kfS04hu2LHehjRgHm9B82z+\nN8NHh9X1ZhO0ce28cqO/Q60k8wJZqHfiGUG1ItEbMA0iQJbQ31O8wHnw3n/f\nUtRCvPCVapHUpy63yqVD3GXAfIVGHkqG2PDWHkokAl2C7yzkrPFUlIC4xUFi\nzzU3\r\n=/ZOI\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCtwvNCTTtQYwqudh0PRdbEwgDwZfIr0cUlo6BNGGGFdAIgDcbY8uUd/zpeu9DK2iE6gxsozXlafaofZoKbHVHmORo="}],"size":61888,"noattachment":false,"key":"/ajv-formats/-/ajv-formats-0.3.2.tgz"},"maintainers":[{"name":"esp","email":"e.poberezkin@me.com"},{"name":"additiveamateur","email":"carlo@machina.bio"}],"_npmUser":{"name":"esp","email":"e.poberezkin@me.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ajv-formats_0.3.2_1600265769311_0.5616764485234946"},"_hasShrinkwrap":false,"readme":"# ajv-formats\n\nJSON Schema formats for Ajv\n\n[![Build Status](https://travis-ci.org/ajv-validator/ajv-formats.svg?branch=master)](https://travis-ci.org/ajv-validator/ajv-formats)\n[![npm](https://img.shields.io/npm/v/ajv-formats.svg)](https://www.npmjs.com/package/ajv-formats)\n[![Gitter](https://img.shields.io/gitter/room/ajv-validator/ajv.svg)](https://gitter.im/ajv-validator/ajv)\n[![GitHub Sponsors](https://img.shields.io/badge/$-sponsors-brightgreen)](https://github.com/sponsors/epoberezkin)\n\n## Usage\n\n```javascript\n// 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```\n\n## Formats\n\nThe package defines these formats:\n\n- _date_: full-date according to [RFC3339](http://tools.ietf.org/html/rfc3339#section-5.6).\n- _time_: time (time-zone is mandatory).\n- _date-time_: date-time (time-zone is mandatory).\n- _iso-time_: time with optional time-zone.\n- _iso-date-time_: date-time with optional time-zone.\n- _duration_: duration from [RFC3339](https://tools.ietf.org/html/rfc3339#appendix-A)\n- _uri_: full URI.\n- _uri-reference_: URI reference, including full and relative URIs.\n- _uri-template_: URI template according to [RFC6570](https://tools.ietf.org/html/rfc6570)\n- _url_ (deprecated): [URL record](https://url.spec.whatwg.org/#concept-url).\n- _email_: email address.\n- _hostname_: host name according to [RFC1034](http://tools.ietf.org/html/rfc1034#section-3.5).\n- _ipv4_: IP address v4.\n- _ipv6_: IP address v6.\n- _regex_: tests whether a string is a valid regular expression by passing it to RegExp constructor.\n- _uuid_: Universally Unique IDentifier according to [RFC4122](http://tools.ietf.org/html/rfc4122).\n- _json-pointer_: JSON-pointer according to [RFC6901](https://tools.ietf.org/html/rfc6901).\n- _relative-json-pointer_: relative JSON-pointer according to [this draft](http://tools.ietf.org/html/draft-luff-relative-json-pointer-00).\n- _byte_: base64 encoded data according to the [openApi 3.0.0 specification](https://spec.openapis.org/oas/v3.0.0#data-types)\n- _int32_: signed 32 bits integer according to the [openApi 3.0.0 specification](https://spec.openapis.org/oas/v3.0.0#data-types)\n- _int64_: signed 64 bits according to the [openApi 3.0.0 specification](https://spec.openapis.org/oas/v3.0.0#data-types)\n- _float_: float according to the [openApi 3.0.0 specification](https://spec.openapis.org/oas/v3.0.0#data-types)\n- _double_: double according to the [openApi 3.0.0 specification](https://spec.openapis.org/oas/v3.0.0#data-types)\n- _password_: password string according to the [openApi 3.0.0 specification](https://spec.openapis.org/oas/v3.0.0#data-types)\n- _binary_: binary string according to the [openApi 3.0.0 specification](https://spec.openapis.org/oas/v3.0.0#data-types)\n\nSee regular expressions used for format validation and the sources that were used in [formats.ts](https://github.com/ajv-validator/ajv-formats/blob/master/src/formats.ts).\n\n**Please note**: JSON Schema draft-07 also defines formats `iri`, `iri-reference`, `idn-hostname` and `idn-email` for URLs, hostnames and emails with international characters. These formats are available in [ajv-formats-draft2019](https://github.com/luzlab/ajv-formats-draft2019) plugin.\n\n## Keywords to compare values: `formatMaximum` / `formatMinimum` and `formatExclusiveMaximum` / `formatExclusiveMinimum`\n\nThese keywords allow to define minimum/maximum constraints when the format keyword defines ordering (`compare` function in format definition).\n\nThese keywords are added to ajv instance when ajv-formats is used without options or with option `keywords: true`.\n\nThese keywords apply only to strings. If the data is not a string, the validation succeeds.\n\nThe value of keywords `formatMaximum`/`formatMinimum` and `formatExclusiveMaximum`/`formatExclusiveMinimum` should be a string or [\\$data reference](https://github.com/ajv-validator/ajv/blob/master/docs/validation.md#data-reference). This value is the maximum (minimum) allowed value for the data to be valid as determined by `format` keyword. If `format` keyword is not present schema compilation will throw exception.\n\nWhen these keyword are added, they also add comparison functions to formats `\"date\"`, `\"time\"` and `\"date-time\"`. User-defined formats also can have comparison functions. See [addFormat](https://github.com/ajv-validator/ajv/blob/master/docs/api.md#api-addformat) method.\n\n```javascript\nrequire(\"ajv-formats\")(ajv)\n\nconst schema = {\n  type: \"string\",\n  format: \"date\",\n  formatMinimum: \"2016-02-06\",\n  formatExclusiveMaximum: \"2016-12-27\",\n}\n\nconst validDataList = [\"2016-02-06\", \"2016-12-26\"]\n\nconst invalidDataList = [\"2016-02-05\", \"2016-12-27\", \"abc\"]\n```\n\n## Options\n\nOptions can be passed via the second parameter. Options value can be\n\n1. The list of format names that will be added to ajv instance:\n\n```javascript\naddFormats(ajv, [\"date\", \"time\"])\n```\n\n**Please note**: when ajv encounters an undefined format it throws exception (unless ajv instance was configured with `strict: false` option). To allow specific undefined formats they have to be passed to ajv instance via `formats` option with `true` value:\n\n```javascript\nconst ajv = new Ajv((formats: {date: true, time: true})) // to ignore \"date\" and \"time\" formats in schemas.\n```\n\n2. Format validation mode (default is `\"full\"`) with optional list of format names and `keywords` option to add additional format comparison keywords:\n\n```javascript\naddFormats(ajv, {mode: \"fast\"})\n```\n\nor\n\n```javascript\naddFormats(ajv, {mode: \"fast\", formats: [\"date\", \"time\"], keywords: true})\n```\n\nIn `\"fast\"` mode the following formats are simplified: `\"date\"`, `\"time\"`, `\"date-time\"`, `\"iso-time\"`, `\"iso-date-time\"`, `\"uri\"`, `\"uri-reference\"`, `\"email\"`. For example, `\"date\"`, `\"time\"` and `\"date-time\"` do not validate ranges in `\"fast\"` mode, only string structure, and other formats have simplified regular expressions.\n\n## Tests\n\n```bash\nnpm install\ngit submodule update --init\nnpm test\n```\n\n## License\n\n[MIT](https://github.com/ajv-validator/ajv-formats/blob/master/LICENSE)\n","publish_time":1600265769477,"_cnpm_publish_time":1600265769477,"dist-tags":{"beta":"3.0.0-rc.0","latest":"3.0.1"}}