Skip to content

Commit

Permalink
Merge c34840c into 521c3a5
Browse files Browse the repository at this point in the history
  • Loading branch information
rgeerts committed Jul 17, 2020
2 parents 521c3a5 + c34840c commit 6e6413c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ There are two modes of format validation: `fast` and `full`. This mode affects f

You can add additional formats and replace any of the formats above using [addFormat](#api-addformat) method.

The option `unknownFormats` allows changing the default behaviour when an unknown format is encountered. In this case Ajv can either fail schema compilation (default) or ignore it (default in versions before 5.0.0). You also can whitelist specific format(s) to be ignored. See [Options](#options) for details.
The option `unknownFormats` allows changing the default behaviour when an unknown format is encountered. In this case Ajv can either fail schema compilation (default) or ignore it (default in versions before 5.0.0). You also can allowlist specific format(s) to be ignored. See [Options](#options) for details.

You can find regular expressions used for format validation and the sources that were used in [formats.js](https://github.com/ajv-validator/ajv/blob/master/lib/compile/formats.js).

Expand Down
4 changes: 2 additions & 2 deletions spec/extras/$data/format.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@
"valid": false
},
{
"description": "whitelisted unknown format is valid",
"description": "allowlisted unknown format is valid",
"data": {
"str": "any value",
"strFormat": "allowedUnknown"
},
"valid": true
},
{
"description": "not whitelisted unknown format is invalid",
"description": "not allowlisted unknown format is invalid",
"data": {
"str": "any value",
"strFormat": "completelyUnknown"
Expand Down
4 changes: 2 additions & 2 deletions spec/options/unknownFormats.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe('unknownFormats option', function() {
});

describe('= [String]', function() {
it('should pass schema compilation and be valid if whitelisted unknown format is used', function() {
it('should pass schema compilation and be valid if alloylisted unknown format is used', function() {
test(new Ajv({unknownFormats: ['allowed']}));

function test(ajv) {
Expand All @@ -83,7 +83,7 @@ describe('unknownFormats option', function() {
}
});

it('should be valid if whitelisted unknown format is used via $data', function() {
it('should be valid if alloylisted unknown format is used via $data', function() {
test(new Ajv({$data: true, unknownFormats: ['allowed']}));

function test(ajv) {
Expand Down
2 changes: 1 addition & 1 deletion spec/tests/rules/format.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
{
"description": "whitelisted unknown format is valid",
"description": "alloylisted unknown format is valid",
"schema": {
"format": "allowedUnknown"
},
Expand Down

0 comments on commit 6e6413c

Please sign in to comment.