Chromium Code Reviews| Index: chrome/renderer/resources/json_schema.js |
| =================================================================== |
| --- chrome/renderer/resources/json_schema.js (revision 14729) |
| +++ chrome/renderer/resources/json_schema.js (working copy) |
| @@ -71,7 +71,9 @@ |
| numberMaxValue: "Value must not be greater than *.", |
| numberMaxDecimal: "Value must not have more than * decimal places.", |
| invalidType: "Expected '*' but got '*'.", |
| - invalidChoice: "Value does not match any valid type choices." |
| + invalidChoice: "Value does not match any valid type choices.", |
| + invalidPropertyType: "Missing property type.", |
| + schemaRequired: "Schema value required.", |
| }; |
| /** |
| @@ -121,6 +123,11 @@ |
| opt_path) { |
| var path = opt_path || ""; |
| + if (!schema) { |
| + this.addError(path, "schemaRequired"); |
| + return; |
| + } |
| + |
| // If the schema has an extends property, the instance must validate against |
| // that schema too. |
| if (schema.extends) |
| @@ -209,7 +216,9 @@ |
| schema, path) { |
| for (var prop in schema.properties) { |
| var propPath = path ? path + "." + prop : prop; |
| - if (prop in instance && instance[prop] !== null && |
| + if (!schema.properties[prop]) { |
| + this.addError(propPath, "invalidPropertyType"); |
|
Aaron Boodman
2009/04/28 20:21:31
This branch will get entered when schema.propertie
Erik does not do reviews
2009/04/28 20:29:34
No. I'm looking for undefined. The problem I'm t
|
| + } else if (prop in instance && instance[prop] !== null && |
| instance[prop] !== undefined) { |
| this.validate(instance[prop], schema.properties[prop], propPath); |
| } else if (!schema.properties[prop].optional) { |