From d3ad4be913125b1c2947f5a98e5634f18e2fca17 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin Date: Sat, 8 Apr 2017 21:16:17 +0100 Subject: [PATCH 1/9] docs: update beta version --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2bc5d52..3dfdcd7 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,9 @@ The fastest JSON Schema validator for node.js and browser. Supports [v5 proposal [![Gitter](https://img.shields.io/gitter/room/ajv-validator/ajv.svg)](https://gitter.im/ajv-validator/ajv) -__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`. +__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`. -Also see [docs](https://github.com/epoberezkin/ajv/tree/5.0.4-beta.1) for 5.0.4. +Also see [docs](https://github.com/epoberezkin/ajv/tree/5.0.4-beta.3) for 5.0.4. ## Contents @@ -94,7 +94,7 @@ Currently Ajv is the only validator that passes all the tests from [JSON Schema npm install ajv ``` -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)): +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)): ``` npm install ajv@^5.0.4-beta From 2ec4f5a95941a6954c698e4d7ba98428ccfa54a9 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin Date: Sun, 9 Apr 2017 00:31:08 +0100 Subject: [PATCH 2/9] docs: logo --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 3dfdcd7..35005f6 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ + + # Ajv: Another JSON Schema Validator The fastest JSON Schema validator for node.js and browser. Supports [v5 proposals](https://github.com/json-schema/json-schema/wiki/v5-Proposals). From 269285eac3a216dbb8083092224b9ed6d6d9f024 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin Date: Sun, 9 Apr 2017 00:36:16 +0100 Subject: [PATCH 3/9] docs: update logo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 35005f6..1391c84 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ - +Ajv logo # Ajv: Another JSON Schema Validator From 33e74df21aae63a14bfed14027f51ed206bf91de Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin Date: Sun, 9 Apr 2017 13:05:06 +0100 Subject: [PATCH 4/9] docs: update gh-pages script --- scripts/travis-gh-pages | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/travis-gh-pages b/scripts/travis-gh-pages index ac8b8f5..63f2fa4 100755 --- a/scripts/travis-gh-pages +++ b/scripts/travis-gh-pages @@ -12,6 +12,8 @@ if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" && $TRAV currentDir=$(pwd) cd ../gh-pages $currentDir/node_modules/.bin/gh-pages-generator + # remove logo from README + sed -i "" -E "s/]+ajv_logo[^>]+>//" index.md git config user.email "$GIT_USER_EMAIL" git config user.name "$GIT_USER_NAME" git add . From 02eeae0aa495d63b743083a36d68a3d1ac9c310f Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin Date: Sun, 9 Apr 2017 13:16:40 +0100 Subject: [PATCH 5/9] docs: rebuild gh-pages when travis-gh-pages script changes --- scripts/travis-gh-pages | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/travis-gh-pages b/scripts/travis-gh-pages index 63f2fa4..9fb1e57 100755 --- a/scripts/travis-gh-pages +++ b/scripts/travis-gh-pages @@ -3,7 +3,7 @@ set -e if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" && $TRAVIS_JOB_NUMBER =~ ".3" ]]; then - git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qE '\.md$|^LICENSE$' && { + git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qE '\.md$|^LICENSE$|^travis-gh-pages$' && { rm -rf ../gh-pages git clone -b gh-pages --single-branch https://${GITHUB_TOKEN}@github.com/epoberezkin/ajv.git ../gh-pages mkdir -p ../gh-pages/_source From 291fb92b3296cedd91b50e5a28fae022ab5532c9 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin Date: Sun, 9 Apr 2017 17:35:13 +0100 Subject: [PATCH 6/9] docs: fix rebuild gh-pages when travis-gh-pages script changes --- scripts/travis-gh-pages | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/travis-gh-pages b/scripts/travis-gh-pages index 9fb1e57..6b92c08 100755 --- a/scripts/travis-gh-pages +++ b/scripts/travis-gh-pages @@ -3,7 +3,7 @@ set -e if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" && $TRAVIS_JOB_NUMBER =~ ".3" ]]; then - git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qE '\.md$|^LICENSE$|^travis-gh-pages$' && { + git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qE '\.md$|^LICENSE$|travis-gh-pages$' && { rm -rf ../gh-pages git clone -b gh-pages --single-branch https://${GITHUB_TOKEN}@github.com/epoberezkin/ajv.git ../gh-pages mkdir -p ../gh-pages/_source From 4fa0beb32a949f44becbf34478f7a4ff4e58218f Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin Date: Sun, 9 Apr 2017 17:59:35 +0100 Subject: [PATCH 7/9] docs: fix sed command to remove logo --- scripts/travis-gh-pages | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/travis-gh-pages b/scripts/travis-gh-pages index 6b92c08..46ded16 100755 --- a/scripts/travis-gh-pages +++ b/scripts/travis-gh-pages @@ -13,7 +13,7 @@ if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" && $TRAV cd ../gh-pages $currentDir/node_modules/.bin/gh-pages-generator # remove logo from README - sed -i "" -E "s/]+ajv_logo[^>]+>//" index.md + sed -i -E "s/]+ajv_logo[^>]+>//" index.md git config user.email "$GIT_USER_EMAIL" git config user.name "$GIT_USER_NAME" git add . From 4de3c7bacc3a2ecd9f2975366405215b333ecb29 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin Date: Fri, 14 Apr 2017 22:12:32 +0100 Subject: [PATCH 8/9] docs: JSON syntax highlight --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1391c84..9d4fcbb 100644 --- a/README.md +++ b/README.md @@ -602,7 +602,7 @@ If the option were `"failing"` then property `additional1` would have been remov __Please note__: If you use `removeAdditional` option with `additionalProperties` keyword inside `anyOf`/`oneOf` keywords your validation can fail with this schema, for example: -```JSON +```json { "type": "object", "oneOf": [ @@ -630,7 +630,7 @@ With the option `removeAdditional: true` the validation will pass for the object 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: -```JSON +```json { "type": "object", "properties": { From fd2064bd282784c89bb45c3311598bcced37b14b Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin Date: Mon, 17 Apr 2017 13:44:20 +0100 Subject: [PATCH 9/9] docs: typos in FAQ --- FAQ.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FAQ.md b/FAQ.md index d11c6fd..d5bec63 100644 --- a/FAQ.md +++ b/FAQ.md @@ -67,10 +67,10 @@ See [#22](https://github.com/epoberezkin/ajv/issues/22), [#125](https://github.c ##### Why Ajv does not replace references ($ref) with the actual referenced schemas as some validators do? 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. -2. When schemas are recursive (or mutually recursive) resolving references would result in recursive data-structures, that can be difficult to process. +2. When schemas are recursive (or mutually recursive) resolving references would result in self-referencing recursive data-structures that can be difficult to process. 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. -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. +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. ##### How can I generate a schema where `$ref` keywords are replaced with referenced schemas?