.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / table / node_modules / ajv / README.md
1 <img align="right" alt="Ajv logo" width="160" src="https://ajv.js.org/img/ajv.svg">
2
3 &nbsp;
4
5 # Ajv JSON schema validator
6
7 The fastest JSON validator for Node.js and browser.
8
9 Supports JSON Schema draft-06/07/2019-09/2020-12 (draft-04 is supported in [version 6](https://github.com/ajv-validator/ajv/tree/v6)) and JSON Type Definition [RFC8927](https://datatracker.ietf.org/doc/rfc8927/).
10
11 [![build](https://github.com/ajv-validator/ajv/workflows/build/badge.svg)](https://github.com/ajv-validator/ajv/actions?query=workflow%3Abuild)
12 [![npm](https://img.shields.io/npm/v/ajv.svg)](https://www.npmjs.com/package/ajv)
13 [![npm downloads](https://img.shields.io/npm/dm/ajv.svg)](https://www.npmjs.com/package/ajv)
14 [![Coverage Status](https://coveralls.io/repos/github/ajv-validator/ajv/badge.svg?branch=master)](https://coveralls.io/github/ajv-validator/ajv?branch=master)
15 [![Gitter](https://img.shields.io/gitter/room/ajv-validator/ajv.svg)](https://gitter.im/ajv-validator/ajv)
16 [![GitHub Sponsors](https://img.shields.io/badge/$-sponsors-brightgreen)](https://github.com/sponsors/epoberezkin)
17
18 ## Platinum sponsors
19
20 [<img src="https://ajv.js.org/img/mozilla.svg" width="45%">](https://www.mozilla.org)<img src="https://ajv.js.org/img/gap.svg" width="8%">[<img src="https://ajv.js.org/img/reserved.svg" width="45%">](https://opencollective.com/ajv)
21
22 ## Contributing
23
24 More than 100 people contributed to Ajv, and we would love to have you join the development. We welcome implementing new features that will benefit many users and ideas to improve our documentation.
25
26 Please review [Contributing guidelines](./CONTRIBUTING.md) and [Code components](https://ajv.js.org/components.html).
27
28 ## Documentation
29
30 All documentation is available on the [Ajv website](https://ajv.js.org).
31
32 Some useful site links:
33 - [Getting started](https://ajv.js.org/guide/getting-started.html)
34 - [JSON Schema vs JSON Type Definition](https://ajv.js.org/guide/schema-language.html)
35 - [API reference](https://ajv.js.org/api.html)
36 - [Strict mode](https://ajv.js.org/strict-mode.html)
37 - [Standalone validation code](https://ajv.js.org/standalone.html)
38 - [Security considerations](https://ajv.js.org/security.html)
39 - [Command line interface](https://ajv.js.org/packages/ajv-cli.html)
40 - [Frequently Asked Questions](https://ajv.js.org/faq.html)
41
42 ## <a name="sponsors"></a>Please [sponsor Ajv development](https://github.com/sponsors/epoberezkin)
43
44 Since I asked to support Ajv development 40 people and 6 organizations contributed via GitHub and OpenCollective - this support helped receiving the MOSS grant!
45
46 Your continuing support is very important - the funds will be used to develop and maintain Ajv once the next major version is released.
47
48 Please sponsor Ajv via:
49
50 - [GitHub sponsors page](https://github.com/sponsors/epoberezkin) (GitHub will match it)
51 - [Ajv Open Collective️](https://opencollective.com/ajv)
52
53 Thank you.
54
55 #### Open Collective sponsors
56
57 <a href="https://opencollective.com/ajv"><img src="https://opencollective.com/ajv/individuals.svg?width=890"></a>
58
59 <a href="https://opencollective.com/ajv/organization/0/website"><img src="https://opencollective.com/ajv/organization/0/avatar.svg"></a>
60 <a href="https://opencollective.com/ajv/organization/1/website"><img src="https://opencollective.com/ajv/organization/1/avatar.svg"></a>
61 <a href="https://opencollective.com/ajv/organization/2/website"><img src="https://opencollective.com/ajv/organization/2/avatar.svg"></a>
62 <a href="https://opencollective.com/ajv/organization/3/website"><img src="https://opencollective.com/ajv/organization/3/avatar.svg"></a>
63 <a href="https://opencollective.com/ajv/organization/4/website"><img src="https://opencollective.com/ajv/organization/4/avatar.svg"></a>
64 <a href="https://opencollective.com/ajv/organization/5/website"><img src="https://opencollective.com/ajv/organization/5/avatar.svg"></a>
65 <a href="https://opencollective.com/ajv/organization/6/website"><img src="https://opencollective.com/ajv/organization/6/avatar.svg"></a>
66 <a href="https://opencollective.com/ajv/organization/7/website"><img src="https://opencollective.com/ajv/organization/7/avatar.svg"></a>
67 <a href="https://opencollective.com/ajv/organization/8/website"><img src="https://opencollective.com/ajv/organization/8/avatar.svg"></a>
68 <a href="https://opencollective.com/ajv/organization/9/website"><img src="https://opencollective.com/ajv/organization/9/avatar.svg"></a>
69
70 ## Performance
71
72 Ajv generates code to turn JSON Schemas into super-fast validation functions that are efficient for v8 optimization.
73
74 Currently Ajv is the fastest and the most standard compliant validator according to these benchmarks:
75
76 - [json-schema-benchmark](https://github.com/ebdrup/json-schema-benchmark) - 50% faster than the second place
77 - [jsck benchmark](https://github.com/pandastrike/jsck#benchmarks) - 20-190% faster
78 - [z-schema benchmark](https://rawgit.com/zaggino/z-schema/master/benchmark/results.html)
79 - [themis benchmark](https://cdn.rawgit.com/playlyfe/themis/master/benchmark/results.html)
80
81 Performance of different validators by [json-schema-benchmark](https://github.com/ebdrup/json-schema-benchmark):
82
83 [![performance](https://chart.googleapis.com/chart?chxt=x,y&cht=bhs&chco=76A4FB&chls=2.0&chbh=62,4,1&chs=600x416&chxl=-1:|ajv|@exodus&#x2F;schemasafe|is-my-json-valid|djv|@cfworker&#x2F;json-schema|jsonschema&chd=t:100,69.2,51.5,13.1,5.1,1.2)](https://github.com/ebdrup/json-schema-benchmark/blob/master/README.md#performance)
84
85 ## Features
86
87 - Ajv implements JSON Schema [draft-06/07/2019-09/2020-12](http://json-schema.org/) standards (draft-04 is supported in v6):
88   - all validation keywords (see [JSON Schema validation keywords](https://ajv.js.org/json-schema.html))
89   - [OpenAPI](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md) extensions:
90     - NEW: keyword [discriminator](https://ajv.js.org/json-schema.md#discriminator).
91     - keyword [nullable](https://ajv.js.org/json-schema.md#nullable).
92   - full support of remote references (remote schemas have to be added with `addSchema` or compiled to be available)
93   - support of recursive references between schemas
94   - correct string lengths for strings with unicode pairs
95   - JSON Schema [formats](https://ajv.js.org/guide/formats.html) (with [ajv-formats](https://github.com/ajv-validator/ajv-formats) plugin).
96   - [validates schemas against meta-schema](https://ajv.js.org/api.html#api-validateschema)
97 - NEW: supports [JSON Type Definition](https://datatracker.ietf.org/doc/rfc8927/):
98   - all keywords (see [JSON Type Definition schema forms](https://ajv.js.org/json-type-definition.html))
99   - meta-schema for JTD schemas
100   - "union" keyword and user-defined keywords (can be used inside "metadata" member of the schema)
101 - supports [browsers](https://ajv.js.org/guide/environments.html#browsers) and Node.js 10.x - current
102 - [asynchronous loading](https://ajv.js.org/guide/managing-schemas.html#asynchronous-schema-loading) of referenced schemas during compilation
103 - "All errors" validation mode with [option allErrors](https://ajv.js.org/options.html#allerrors)
104 - [error messages with parameters](https://ajv.js.org/api.html#validation-errors) describing error reasons to allow error message generation
105 - i18n error messages support with [ajv-i18n](https://github.com/ajv-validator/ajv-i18n) package
106 - [removing-additional-properties](https://ajv.js.org/guide/modifying-data.html#removing-additional-properties)
107 - [assigning defaults](https://ajv.js.org/guide/modifying-data.html#assigning-defaults) to missing properties and items
108 - [coercing data](https://ajv.js.org/guide/modifying-data.html#coercing-data-types) to the types specified in `type` keywords
109 - [user-defined keywords](https://ajv.js.org/guide/user-keywords.html)
110 - additional extension keywords with [ajv-keywords](https://github.com/ajv-validator/ajv-keywords) package
111 - [\$data reference](https://ajv.js.org/guide/combining-schemas.html#data-reference) to use values from the validated data as values for the schema keywords
112 - [asynchronous validation](https://ajv.js.org/guide/async-validation.html) of user-defined formats and keywords
113
114 ## Install
115
116 To install version 7:
117
118 ```
119 npm install ajv
120 ```
121
122 ## <a name="usage"></a>Getting started
123
124 Try it in the Node.js REPL: https://runkit.com/npm/ajv
125
126 In JavaScript:
127
128 ```javascript
129 // or ESM/TypeScript import
130 import Ajv from "ajv"
131 // Node.js require:
132 const Ajv = require("ajv")
133
134 const ajv = new Ajv() // options can be passed, e.g. {allErrors: true}
135
136 const schema = {
137   type: "object",
138   properties: {
139     foo: {type: "integer"},
140     bar: {type: "string"}
141   },
142   required: ["foo"],
143   additionalProperties: false,
144 }
145
146 const validate = ajv.compile(schema)
147 const valid = validate(data)
148 if (!valid) console.log(validate.errors)
149 ```
150
151 Learn how to use Ajv and see more examples in the [Guide: getting started](https://ajv.js.org/guide/getting-started.html)
152
153 ## Changes history
154
155 See [https://github.com/ajv-validator/ajv/releases](https://github.com/ajv-validator/ajv/releases)
156
157 **Please note**: [Changes in version 7.0.0](https://github.com/ajv-validator/ajv/releases/tag/v7.0.0)
158
159 [Version 6.0.0](https://github.com/ajv-validator/ajv/releases/tag/v6.0.0).
160
161 ## Code of conduct
162
163 Please review and follow the [Code of conduct](./CODE_OF_CONDUCT.md).
164
165 Please report any unacceptable behaviour to ajv.validator@gmail.com - it will be reviewed by the project team.
166
167 ## Security contact
168
169 To report a security vulnerability, please use the
170 [Tidelift security contact](https://tidelift.com/security).
171 Tidelift will coordinate the fix and disclosure. Please do NOT report security vulnerabilities via GitHub issues.
172
173 ## Open-source software support
174
175 Ajv is a part of [Tidelift subscription](https://tidelift.com/subscription/pkg/npm-ajv?utm_source=npm-ajv&utm_medium=referral&utm_campaign=readme) - it provides a centralised support to open-source software users, in addition to the support provided by software maintainers.
176
177 ## License
178
179 [MIT](./LICENSE)