Skip to content

Commit c51abef

Browse files
authored
fix: non-empty validation error message (#116)
1 parent cdbf8b7 commit c51abef

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

src/ValidationError.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ class ValidationError extends Error {
10301030
const { limit } = /** @type {import("ajv").LimitParams} */ (params);
10311031

10321032
if (limit === 1) {
1033-
return `${dataPath} should be an non-empty string${getSchemaNonTypes(
1033+
return `${dataPath} should be a non-empty string${getSchemaNonTypes(
10341034
parentSchema
10351035
)}.${this.getSchemaPartDescription(parentSchema)}`;
10361036
}
@@ -1048,7 +1048,7 @@ class ValidationError extends Error {
10481048
const { limit } = /** @type {import("ajv").LimitParams} */ (params);
10491049

10501050
if (limit === 1) {
1051-
return `${dataPath} should be an non-empty array${getSchemaNonTypes(
1051+
return `${dataPath} should be a non-empty array${getSchemaNonTypes(
10521052
parentSchema
10531053
)}.${this.getSchemaPartDescription(parentSchema)}`;
10541054
}
@@ -1062,7 +1062,7 @@ class ValidationError extends Error {
10621062
const { limit } = /** @type {import("ajv").LimitParams} */ (params);
10631063

10641064
if (limit === 1) {
1065-
return `${dataPath} should be an non-empty object${getSchemaNonTypes(
1065+
return `${dataPath} should be a non-empty object${getSchemaNonTypes(
10661066
parentSchema
10671067
)}.${this.getSchemaPartDescription(parentSchema)}`;
10681068
}

test/__snapshots__/index.test.js.snap

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ exports[`Validation should fail validation for array with maxItems 1`] = `
425425
426426
exports[`Validation should fail validation for array with minItems 1`] = `
427427
"Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
428-
- configuration.arrayWithMinItems should be an non-empty array."
428+
- configuration.arrayWithMinItems should be a non-empty array."
429429
`;
430430
431431
exports[`Validation should fail validation for array with only number 1`] = `
@@ -480,13 +480,13 @@ exports[`Validation should fail validation for boolean type 1`] = `
480480
481481
exports[`Validation should fail validation for configuration dataPath #1 1`] = `
482482
"Invalid options object. MyPlugin has been initialized using an options object that does not match the API schema.
483-
- options.entry should be an non-empty string.
483+
- options.entry should be a non-empty string.
484484
-> An entry point without name. The string is resolved to a module which is loaded upon startup."
485485
`;
486486
487487
exports[`Validation should fail validation for configuration dataPath 1`] = `
488488
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
489-
- configuration.entry should be an non-empty string.
489+
- configuration.entry should be a non-empty string.
490490
-> An entry point without name. The string is resolved to a module which is loaded upon startup."
491491
`;
492492
@@ -556,7 +556,7 @@ exports[`Validation should fail validation for contains inside items 1`] = `
556556
557557
exports[`Validation should fail validation for css-loader name 1`] = `
558558
"Invalid configuration object. CSS Loader has been initialized using a configuration object that does not match the API schema.
559-
- configuration.entry should be an non-empty string.
559+
- configuration.entry should be a non-empty string.
560560
-> An entry point without name. The string is resolved to a module which is loaded upon startup."
561561
`;
562562
@@ -589,13 +589,13 @@ exports[`Validation should fail validation for empty const 1`] = `
589589
590590
exports[`Validation should fail validation for empty entry bundle array 1`] = `
591591
"Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
592-
- configuration.entry['bundle'] should be an non-empty array.
592+
- configuration.entry['bundle'] should be a non-empty array.
593593
-> A non-empty array of non-empty strings"
594594
`;
595595
596596
exports[`Validation should fail validation for empty entry string 1`] = `
597597
"Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
598-
- configuration.entry should be an non-empty string.
598+
- configuration.entry should be a non-empty string.
599599
-> An entry point without name. The string is resolved to a module which is loaded upon startup."
600600
`;
601601
@@ -997,7 +997,7 @@ exports[`Validation should fail validation for min length 1`] = `
997997
998998
exports[`Validation should fail validation for min properties 1`] = `
999999
"Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
1000-
- configuration.entry should be an non-empty object.
1000+
- configuration.entry should be a non-empty object.
10011001
-> Multiple entry bundles are created. The key is the chunk name. The value can be a string or an array."
10021002
`;
10031003
@@ -1152,7 +1152,7 @@ exports[`Validation should fail validation for no type like array with minItems
11521152
11531153
exports[`Validation should fail validation for no type like array with minItems 3`] = `
11541154
"Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
1155-
- configuration.noTypeMinProperties1 should be an non-empty object | should be any non-object."
1155+
- configuration.noTypeMinProperties1 should be a non-empty object | should be any non-object."
11561156
`;
11571157
11581158
exports[`Validation should fail validation for no type like array with minItems 4`] = `
@@ -1162,7 +1162,7 @@ exports[`Validation should fail validation for no type like array with minItems
11621162
11631163
exports[`Validation should fail validation for no type like array with minItems equals 1 1`] = `
11641164
"Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
1165-
- configuration.noTypeLikeArrayMinItems1 should be an non-empty array | should be any non-array."
1165+
- configuration.noTypeLikeArrayMinItems1 should be a non-empty array | should be any non-array."
11661166
`;
11671167
11681168
exports[`Validation should fail validation for no type like number with exclusive maximum 1`] = `
@@ -1248,7 +1248,7 @@ exports[`Validation should fail validation for no type like string with minLengt
12481248
12491249
exports[`Validation should fail validation for no type like string with minLength equals 1 1`] = `
12501250
"Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
1251-
- configuration.noTypeLikeStringMinLength1 should be an non-empty string | should be any non-string."
1251+
- configuration.noTypeLikeStringMinLength1 should be a non-empty string | should be any non-string."
12521252
`;
12531253
12541254
exports[`Validation should fail validation for no type like string with pattern 1`] = `
@@ -1302,7 +1302,7 @@ exports[`Validation should fail validation for not empty string #1 1`] = `
13021302
13031303
exports[`Validation should fail validation for not empty string #2 1`] = `
13041304
"Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
1305-
- configuration.notEmptyString2 should be an non-empty string."
1305+
- configuration.notEmptyString2 should be a non-empty string."
13061306
`;
13071307
13081308
exports[`Validation should fail validation for not enum 1`] = `
@@ -1809,7 +1809,7 @@ exports[`Validation should fail validation for string with minLength, maxLength
18091809
18101810
exports[`Validation should fail validation for terser-webpack-plugin name 1`] = `
18111811
"Invalid configuration object. Terser Plugin has been initialized using a configuration object that does not match the API schema.
1812-
- configuration.entry should be an non-empty string.
1812+
- configuration.entry should be a non-empty string.
18131813
-> An entry point without name. The string is resolved to a module which is loaded upon startup."
18141814
`;
18151815
@@ -1837,7 +1837,7 @@ exports[`Validation should fail validation for uniqueItems 2`] = `
18371837
18381838
exports[`Validation should fail validation for webpack name 1`] = `
18391839
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
1840-
- configuration.entry should be an non-empty string.
1840+
- configuration.entry should be a non-empty string.
18411841
-> An entry point without name. The string is resolved to a module which is loaded upon startup."
18421842
`;
18431843

0 commit comments

Comments
 (0)