Export to GitHub

jsonschema - issue #5

Null allowed on union types without explicit null declaration


Posted on Dec 4, 2008 by Happy Kangaroo

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.

Comment #1

Posted on Apr 16, 2009 by Swift Panda

(No comment was entered for this change.)

Status: Fixed

Labels:
Type-Defect Priority-Medium