schema-utils
schema-utils copied to clipboard
It accepts arrays as the object type
- Operating System:
- Node Version:
- NPM Version:
- webpack Version:
- schema-utils Version:
When an array is provided instead of an object, it passes the validation.
Actual Behavior
Let's take a devServer schema example from the fixtures.
let schema = '{"devServer":{"description":"Options for the webpack-dev-server","type":"object"}}';
try {
validate(schema, []);
} catch (e) {
console.log(e.message);
}
, and it passes the validation.
Expected Behavior
I would expect the validation error, because an object and an array are slightly different.
let schema = '{"devServer":{"description":"Options for the webpack-dev-server","type":"object"}}';
try {
validate(schema, []);
} catch (e) {
console.log(e.message); // schema must be object
}
Moreover, it doesn't accept an object instead of an array, and it does fail when it happens.