Skip to content

It accepts arrays as the object type #193

@kudashevs

Description

@kudashevs
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions