Skip to content

Commit a1ebd03

Browse files
committed
Merge branch 'rgeerts-improved_language'
2 parents 521c3a5 + bf63684 commit a1ebd03

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ There are two modes of format validation: `fast` and `full`. This mode affects f
330330

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

333-
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.
333+
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 allow specific format(s) that will be ignored. See [Options](#options) for details.
334334

335335
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).
336336

spec/extras/$data/format.json

+11-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
"description": "one property has format set in another property",
44
"schema": {
55
"properties": {
6-
"str": { "format": { "$data": "1/strFormat" } },
6+
"str": {
7+
"format": {
8+
"$data": "1/strFormat"
9+
}
10+
},
711
"strFormat": {}
812
}
913
},
@@ -49,15 +53,15 @@
4953
"valid": false
5054
},
5155
{
52-
"description": "whitelisted unknown format is valid",
56+
"description": "allowed unknown format is valid",
5357
"data": {
5458
"str": "any value",
5559
"strFormat": "allowedUnknown"
5660
},
5761
"valid": true
5862
},
5963
{
60-
"description": "not whitelisted unknown format is invalid",
64+
"description": "unknown format is invalid",
6165
"data": {
6266
"str": "any value",
6367
"strFormat": "completelyUnknown"
@@ -85,7 +89,9 @@
8589
"description": "property name is the format for the property value",
8690
"schema": {
8791
"additionalProperties": {
88-
"format": { "$data": "0#" }
92+
"format": {
93+
"$data": "0#"
94+
}
8995
}
9096
},
9197
"tests": [
@@ -115,4 +121,4 @@
115121
}
116122
]
117123
}
118-
]
124+
]

spec/options/unknownFormats.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ describe('unknownFormats option', function() {
7070
});
7171

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

7676
function test(ajv) {
@@ -83,7 +83,7 @@ describe('unknownFormats option', function() {
8383
}
8484
});
8585

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

8989
function test(ajv) {

spec/tests/rules/format.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[
22
{
3-
"description": "whitelisted unknown format is valid",
3+
"description": "allowed unknown format is valid",
44
"schema": {
55
"format": "allowedUnknown"
66
},

0 commit comments

Comments
 (0)