Skip to content

Commit c4ba655

Browse files
committed
Fix scheme validation failing in some edge cases
1 parent 1de4edb commit c4ba655

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

lib/OptionsValidationError.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ OptionsValidationError.formatValidationError = function formatValidationError(er
3434
switch(err.params.type) {
3535
case "object":
3636
return dataPath + " should be an object.";
37+
case "array":
38+
return dataPath + " should be an array.";
3739
case "string":
3840
return dataPath + " should be a string.";
3941
case "boolean":
@@ -43,6 +45,8 @@ OptionsValidationError.formatValidationError = function formatValidationError(er
4345
}
4446
return dataPath + " should be " + err.params.type + ":\n" +
4547
getSchemaPartText(err.parentSchema);
48+
case "instanceof":
49+
return dataPath + " should be an instance of " + getSchemaPartText(err.parentSchema) + ".";
4650
case "required":
4751
var missingProperty = err.params.missingProperty.replace(/^\./, "");
4852
return dataPath + " misses the property '" + missingProperty + "'.\n" +

lib/optionsSchema.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,15 @@
127127
"description": "A directory to serve files non-webpack files from.",
128128
"anyOf": [
129129
{
130+
"items": {
131+
"type": "string"
132+
},
133+
"minItems": 1,
130134
"type": "array"
131135
},
136+
{
137+
"type": "boolean"
138+
},
132139
{
133140
"type": "number"
134141
},
@@ -147,6 +154,9 @@
147154
},
148155
"features": {
149156
"description": "The order of which the features will be triggered.",
157+
"items": {
158+
"type": "string"
159+
},
150160
"type": "array"
151161
},
152162
"compress": {

0 commit comments

Comments
 (0)