bpdusk / jsonschema

Automatically exported from code.google.com/p/jsonschema
0 stars 0 forks source link

Null allowed on union types without explicit null declaration #5

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
If you validate

{
  "stringOrNumber":null
}

with the schema

{
  "type":"object",
  "properties":{
    "stringOrNumber":{"type":["string","number"]}
  }
}

It shuld not be valid, but the js is saying it is. 

there is an 

if (value !== null) {

on line 92 

that prevents a null propertie to get into the checkType and then it is not
validated. 

I just removed the check and it worked, passing on the other test cases I
have, but they are not yet complete, so there might be a reason for the
check I could not find yet. 

Original issue reported on code.google.com by bruno.gradua@gmail.com on 4 Dec 2008 at 12:32

GoogleCodeExporter commented 8 years ago

Original comment by kris...@gmail.com on 16 Apr 2009 at 8:36