Opened 6 years ago

Last modified 2 years ago

#16279 assigned defect

dojox.json.schema.validate incorrectly reports NULL as valid when object specified

Reported by: Greg Girty Owned by: Kris Zyp
Priority: undecided Milestone: 1.15
Component: Dojox Version: 1.8.1
Keywords: Cc:
Blocked By: Blocking:

Description

In the following example, a required object property is validated when only NULL is present:


require(['dojo', 'dojox/json/schema'], function(){

    var s = {properties:{foo:
        {type:['object'], 
        optional:false, 
        properties:{a:{optional:false,type:'string'}} 
        }
    }}
    
    /* Should these not both fail validation?*/
    console.log(dojox.json.schema.validate({foo:null}, s)); // valid is true
    console.log(dojox.json.schema.validate({foo:{}}, s)); // valid is false

});


Attachments (1)

schema.js (8.3 KB) - added by Greg Girty 6 years ago.
Proposed fix, replaced first long if clause in function checkType

Download all attachments as: .zip

Change History (4)

comment:1 Changed 6 years ago by Adam Peller

Owner: changed from Adam Peller to Kris Zyp
Status: newassigned

Changed 6 years ago by Greg Girty

Attachment: schema.js added

Proposed fix, replaced first long if clause in function checkType

comment:2 Changed 3 years ago by dylan

Milestone: tbd1.12

comment:3 Changed 2 years ago by dylan

Milestone: 1.131.15

Ticket planning... move current 1.13 tickets out to 1.15 to make it easier to move tickets into the 1.13 milestone.

Note: See TracTickets for help on using tickets.