Skip to content

Commit

Permalink
docs: update to release v7
Browse files Browse the repository at this point in the history
  • Loading branch information
epoberezkin committed Dec 15, 2020
1 parent f1f4b74 commit 0809171
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
17 changes: 5 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ The fastest JSON Schema validator for Node.js and browser. Supports draft-06/07/

[![build](https://github.com/ajv-validator/ajv/workflows/build/badge.svg)](https://github.com/ajv-validator/ajv/actions?query=workflow%3Abuild)
[![npm](https://img.shields.io/npm/v/ajv.svg)](https://www.npmjs.com/package/ajv)
[![npm (beta)](https://img.shields.io/npm/v/ajv/beta)](https://www.npmjs.com/package/ajv/v/7.0.0-rc.5)
[![npm downloads](https://img.shields.io/npm/dm/ajv.svg)](https://www.npmjs.com/package/ajv)
[![Coverage Status](https://coveralls.io/repos/github/ajv-validator/ajv/badge.svg?branch=master)](https://coveralls.io/github/ajv-validator/ajv?branch=master)
[![Gitter](https://img.shields.io/gitter/room/ajv-validator/ajv.svg)](https://gitter.im/ajv-validator/ajv)
Expand All @@ -18,12 +17,12 @@ The fastest JSON Schema validator for Node.js and browser. Supports draft-06/07/

## Using version 7

Ajv version 7 (beta) is released with these changes:
Ajv version 7 is released with these changes:

- support of JSON Schema draft-2019-09 features: [`unevaluatedProperties`](./json-schema.md#unevaluatedproperties) and [`unevaluatedItems`](./json-schema.md#unevaluateditems), [dynamic recursive references](./validation.md#extending-recursive-schemas) and other [additional keywords](./json-schema.md#json-schema-draft-2019-09).
- to reduce the mistakes in JSON schemas and unexpected validation results, [strict mode](./docs/strict-mode.md) is added - it prohibits ignored or ambiguous JSON Schema elements.
- to make code injection from untrusted schemas impossible, [code generation](./docs/codegen.md) is fully re-written to be safe and to allow code optimization (compiled schema code size is reduced by more than 10%).
- to simplify Ajv extensions, the new keyword API that is used by pre-defined keywords is available to user-defined keywords - it is much easier to define any keywords now, especially with subschemas. [ajv-keywords](https://github.com/ajv-validator/ajv-keywords) package was updated to use the new API (in [v4.0.0-beta.0](https://github.com/ajv-validator/ajv-keywords/releases/tag/v4.0.0-beta.0))
- to simplify Ajv extensions, the new keyword API that is used by pre-defined keywords is available to user-defined keywords - it is much easier to define any keywords now, especially with subschemas. [ajv-keywords](https://github.com/ajv-validator/ajv-keywords) package was updated to use the new API (in [v4.0.0](https://github.com/ajv-validator/ajv-keywords/releases/tag/v4.0.0))
- schemas are compiled to ES6 code (ES5 code generation is also supported with an option).
- to improve reliability and maintainability the code is migrated to TypeScript.

Expand All @@ -32,12 +31,12 @@ Ajv version 7 (beta) is released with these changes:
- the support for JSON-Schema draft-04 is removed - if you have schemas using "id" attributes you have to replace them with "\$id" (or continue using [Ajv v6](https://github.com/ajv-validator/ajv/tree/v6) that will be supported until 02/28/2021).
- all formats are separated to ajv-formats package - they have to be explicitly added if you use them.

See [release notes](https://github.com/ajv-validator/ajv/releases/tag/v7.0.0-beta.0) for the details.
See [release notes](https://github.com/ajv-validator/ajv/releases/tag/v7.0.0) for the details.

To install the new version:

```bash
npm install ajv@beta
npm install ajv
```

See [Getting started](#usage) for code example.
Expand Down Expand Up @@ -193,12 +192,6 @@ Performance of different validators by [json-schema-benchmark](https://github.co

To install version 7:

```
npm install ajv@beta
```

To install the previous [version 6](https://github.com/ajv-validator/ajv/tree/v6):

```
npm install ajv
```
Expand Down Expand Up @@ -388,7 +381,7 @@ If you have published a useful plugin please submit a PR to add it to the next s

See https://github.com/ajv-validator/ajv/releases

**Please note**: [Changes in version 7.0.0-beta](https://github.com/ajv-validator/ajv/releases/tag/v7.0.0-beta.0)
**Please note**: [Changes in version 7.0.0](https://github.com/ajv-validator/ajv/releases/tag/v7.0.0)

[Version 6.0.0](https://github.com/ajv-validator/ajv/releases/tag/v6.0.0).

Expand Down
6 changes: 3 additions & 3 deletions docs/standalone.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This functionality in Ajv v7 supersedes deprecated package ajv-pack that can be
In most cases you would use this functionality via [ajv-cli](https://github.com/jessedc/ajv-cli) (>= 4.0.0) to generate module that exports validation function.

```sh
npm install -g ajv-cli@beta
npm install -g ajv-cli
ajv compile -s schema.json -o validate_schema.js
```

Expand All @@ -24,11 +24,11 @@ See [ajv-cli](https://github.com/jessedc/ajv-cli) docs for additional informatio
## Usage from code

```sh
npm install ajv@beta
npm install ajv
```

```javascript
const Ajv = require("ajv") // version >= v7.0.0-beta.8
const Ajv = require("ajv") // version >= v7.0.0
const ajv = new Ajv({code: {source: true}}) // this option is required to generate standalone code
const standaloneCode = require("ajv/dist/standalone")

Expand Down

0 comments on commit 0809171

Please sign in to comment.