Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Unified Diff: components/json_schema/json_schema_validator.h

Issue 94043003: Ignore unknown attributes when parsing JSON schemas. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added Options enum Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/json_schema/json_schema_validator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/json_schema/json_schema_validator.h
diff --git a/components/json_schema/json_schema_validator.h b/components/json_schema/json_schema_validator.h
index 4584a9da77a5be1bf1b17d5babebc46133b3b913..4e8acaddfd983c68b10c02f126e29b6a498cc2ab 100644
--- a/components/json_schema/json_schema_validator.h
+++ b/components/json_schema/json_schema_validator.h
@@ -70,6 +70,12 @@ class JSONSchemaValidator {
std::string message;
};
+ enum Options {
+ // Ignore unknown attributes. If this option is not set then unknown
+ // attributes will make the schema validation fail.
+ OPTIONS_IGNORE_UNKNOWN_ATTRIBUTES = 1 << 0,
+ };
+
// Error messages.
static const char kUnknownTypeReference[];
static const char kInvalidChoice[];
@@ -108,6 +114,13 @@ class JSONSchemaValidator {
const std::string& schema,
std::string* error);
+ // Same as above but with |options|, which is a bitwise-OR combination of the
+ // Options above.
+ static scoped_ptr<base::DictionaryValue> IsValidSchema(
+ const std::string& schema,
+ int options,
+ std::string* error);
+
// Creates a validator for the specified schema.
//
// NOTE: This constructor assumes that |schema| is well formed and valid.
« no previous file with comments | « no previous file | components/json_schema/json_schema_validator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698