Skip to content
This repository was archived by the owner on Mar 19, 2019. It is now read-only.
This repository was archived by the owner on Mar 19, 2019. It is now read-only.

Mistake in validation errors for disallowed property #8

@drewnoakes

Description

@drewnoakes

Given the following code:

var JSONSchema = require('json-schema');

var instance = {
    a:1,
    b:2
};

var schema = {
    type: 'object',
    properties: {
        a: { type: 'number' }
    },
    additionalProperties: false
};

var result = JSONSchema.validate(instance, schema);

console.log(result);

The output is:

{ valid: false,
  errors: 
   [ { property: '',
       message: 'numberThe property b is not defined in the schema and the schema does not allow additional properties' } ] }

I would have expected:

{ valid: false,
  errors: 
   [ { property: 'b',
       message: 'The property b is not defined in the schema and the schema does not allow additional properties' } ] }

My environment:

$ node --version
v0.8.7

$ npm ls
json-schema-test
└── json-schema@0.2.2

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