When executing dojox.json.ref.resolveJson(), if the schema object passed in extends another schema object, the resolveJson() method does not ascend into the parent schemas.
dojo.require("dojox.json.ref");
dojo.require("dojo.date.stamp");
var schemas = {
"/publications/": {
"id": "publications",
"type": "object",
"properties": {
"publish_date": {
"type": "string",
"format": "date-time"
},
"isbn": {
"type": "integer"
}
}
},
"/books/": {
"id": "books",
"type": "object",
"extends": {
"$ref": "publications"
},
"properties": {
"author": {
"type": "string"
}
}
}
};
dojox.json.ref.resolveJson(schemas);
var publication1 = {
"id": "/publications/1",
"publish_date": "2009-03-22T18:00:00Z",
"isbn": 0987654321
}
dojox.json.ref.resolveJson(publication1, {
schemas: schemas
});
// publish_date was converted from ISO string to date object
console.log(publication1.publish_date instanceof Date);
var book1 = {
"id": "/books/2",
"publish_date": "2009-03-22T18:00:00Z",
"author": "Bob Smith",
"isbn": 1234567890
}
dojox.json.ref.resolveJson(book1, {
schemas: schemas
});
// publish_date was NOT converted from ISO string to date object
// publish_date was specified in a super-schema, so it wasn't looked at
console.log(book1.publish_date instanceof Date);
(In [18467]) Look through super-schemas for date-time information, fixes #8960