Skip to content

Commit 2fc8a64

Browse files
committed
Merge branch 'master' into 5.0.0
2 parents 67dd36a + fd2064b commit 2fc8a64

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

FAQ.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ See [#22](https://github.com/epoberezkin/ajv/issues/22), [#125](https://github.c
6767
##### Why Ajv does not replace references ($ref) with the actual referenced schemas as some validators do?
6868

6969
1. The scope of Ajv is validating data against JSON-Schemas; inlining referenced schemas is not necessary for validation. When Ajv generates code for validation it either inlines the code of referenced schema or uses function calls. Doing schema manipulation is more complex and out of scope.
70-
2. When schemas are recursive (or mutually recursive) resolving references would result in recursive data-structures, that can be difficult to process.
70+
2. When schemas are recursive (or mutually recursive) resolving references would result in self-referencing recursive data-structures that can be difficult to process.
7171
3. There are cases when such inlining would also require adding (or modyfing) `id` attribute in the inlined schema fragment to make the resulting schema equivalent.
7272

73-
There were many conversations about the meaning of `$ref` in [JSON-Schema GitHub organisation](https://github.com/json-schema-org). The consesus is that while it is possible to treat `$ref` as schema inclusion with two caveats (above), this interpretation is unnecessary complex. A more efficient approach is to treat `$ref` as delegation, i.e. a special keyword that validates the current data instance against the referenced schema. The analogy with programming languages is be that `$ref` is a function call rather than a macro. See [here](https://github.com/json-schema-org/json-schema-spec/issues/279), for example.
73+
There were many conversations about the meaning of `$ref` in [JSON-Schema GitHub organisation](https://github.com/json-schema-org). The consesus is that while it is possible to treat `$ref` as schema inclusion with two caveats (above), this interpretation is unnecessary complex. A more efficient approach is to treat `$ref` as a delegation, i.e. a special keyword that validates the current data instance against the referenced schema. The analogy with programming languages is that `$ref` is a function call rather than a macro. See [here](https://github.com/json-schema-org/json-schema-spec/issues/279), for example.
7474

7575

7676
##### How can I generate a schema where `$ref` keywords are replaced with referenced schemas?

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
<img align="right" alt="Ajv logo" width="160" src="http://epoberezkin.github.io/ajv/images/ajv_logo.png">
2+
13
# Ajv: Another JSON Schema Validator
24

35
The fastest JSON Schema validator for node.js and browser with draft 6 support.
@@ -11,9 +13,9 @@ The fastest JSON Schema validator for node.js and browser with draft 6 support.
1113
[![Gitter](https://img.shields.io/gitter/room/ajv-validator/ajv.svg)](https://gitter.im/ajv-validator/ajv)
1214

1315

14-
__Please note__: You can start using NEW beta version [5.0.4](https://github.com/epoberezkin/ajv/releases/tag/5.0.4-beta.1) (see [migration guide from 4.x.x](https://github.com/epoberezkin/ajv/releases/tag/5.0.1-beta.0)) with the support of JSON-Schema draft-06 (not officially published yet): `npm install ajv@^5.0.4-beta`.
16+
__Please note__: You can start using NEW beta version [5.0.4](https://github.com/epoberezkin/ajv/releases/tag/5.0.4-beta.3) (see [migration guide from 4.x.x](https://github.com/epoberezkin/ajv/releases/tag/5.0.1-beta.0)) with the support of JSON-Schema draft-06 (not officially published yet): `npm install ajv@^5.0.4-beta`.
1517

16-
Also see [docs](https://github.com/epoberezkin/ajv/tree/5.0.4-beta.1) for 5.0.4.
18+
Also see [docs](https://github.com/epoberezkin/ajv/tree/5.0.4-beta.3) for 5.0.4.
1719

1820

1921
## Contents
@@ -95,7 +97,7 @@ Currently Ajv is the only validator that passes all the tests from [JSON Schema
9597
npm install ajv
9698
```
9799

98-
To install a stable beta version [5.0.4](https://github.com/epoberezkin/ajv/releases/tag/5.0.4-beta.1) (see [migration guide from 4.x.x](https://github.com/epoberezkin/ajv/releases/tag/5.0.1-beta.0)):
100+
To install a stable beta version [5.0.4](https://github.com/epoberezkin/ajv/releases/tag/5.0.4-beta.3) (see [migration guide from 4.x.x](https://github.com/epoberezkin/ajv/releases/tag/5.0.1-beta.0)):
99101

100102
```
101103
npm install ajv@^5.0.4-beta
@@ -612,7 +614,7 @@ If the option were `"failing"` then property `additional1` would have been remov
612614

613615
__Please note__: If you use `removeAdditional` option with `additionalProperties` keyword inside `anyOf`/`oneOf` keywords your validation can fail with this schema, for example:
614616

615-
```JSON
617+
```json
616618
{
617619
"type": "object",
618620
"oneOf": [
@@ -640,7 +642,7 @@ With the option `removeAdditional: true` the validation will pass for the object
640642

641643
While this behaviour is unexpected (issues [#129](https://github.com/epoberezkin/ajv/issues/129), [#134](https://github.com/epoberezkin/ajv/issues/134)), it is correct. To have the expected behaviour (both objects are allowed and additional properties are removed) the schema has to be refactored in this way:
642644

643-
```JSON
645+
```json
644646
{
645647
"type": "object",
646648
"properties": {

scripts/travis-gh-pages

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -e
44

55
if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" && $TRAVIS_JOB_NUMBER =~ ".3" ]]; then
6-
git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qE '\.md$|^LICENSE$' && {
6+
git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qE '\.md$|^LICENSE$|travis-gh-pages$' && {
77
rm -rf ../gh-pages
88
git clone -b gh-pages --single-branch https://${GITHUB_TOKEN}@github.com/epoberezkin/ajv.git ../gh-pages
99
mkdir -p ../gh-pages/_source
@@ -12,6 +12,8 @@ if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" && $TRAV
1212
currentDir=$(pwd)
1313
cd ../gh-pages
1414
$currentDir/node_modules/.bin/gh-pages-generator
15+
# remove logo from README
16+
sed -i -E "s/<img[^>]+ajv_logo[^>]+>//" index.md
1517
git config user.email "$GIT_USER_EMAIL"
1618
git config user.name "$GIT_USER_NAME"
1719
git add .

0 commit comments

Comments
 (0)