kriszyp/json-schema

Incorrect Object validation

Opened this issue · 0 comments

Not sure if this project is still alive, but.

Let's take this simple JSON:

[ { "foo": "bar" } ]

and a schema for it:

{
    "type": "object"
  , "$schema": "http://json-schema.org/draft-03/schema"
  , "id": "http://jsonschema.net"
  , "required": true
  , "properties": {
        "foo": {
            "type": "string"
          , "id": "http://jsonschema.net/foo"
          , "required": true
        }
    }
}

This should be invalid, and it is if you validate your schema with JSV and schema modules. json-schema, though, says that this JSON is valid, probably because of validate.js:93, since typeof [] === 'object'.