diff options
author | binjin@chromium.org <binjin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-27 18:58:37 +0000 |
---|---|---|
committer | binjin@chromium.org <binjin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-27 18:58:37 +0000 |
commit | 183ce73b72541370cbcd26dc9be9a6019f1f533c (patch) | |
tree | 9433abece2473dbe99440a9f87c4124f1f6c9a9d /components/json_schema/json_schema_validator.h | |
parent | 34ce6290c7246b814a9b032f6c8a526e5f79ffb7 (diff) | |
download | chromium_src-183ce73b72541370cbcd26dc9be9a6019f1f533c.zip chromium_src-183ce73b72541370cbcd26dc9be9a6019f1f533c.tar.gz chromium_src-183ce73b72541370cbcd26dc9be9a6019f1f533c.tar.bz2 |
Add regular expression support in json_schema component
Add support of "pattern" and "patternProperties" attribute into json_schema, with third_party/re2 as regular expression implementation.
BUG=348551
Review URL: https://codereview.chromium.org/195193002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@259943 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components/json_schema/json_schema_validator.h')
-rw-r--r-- | components/json_schema/json_schema_validator.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/components/json_schema/json_schema_validator.h b/components/json_schema/json_schema_validator.h index 4e8acad..ad429ef 100644 --- a/components/json_schema/json_schema_validator.h +++ b/components/json_schema/json_schema_validator.h @@ -32,7 +32,6 @@ class Value; // - disallow // - union types (but replaced with 'choices') // - number.maxDecimal -// - string.pattern // // The following properties are not applicable to the interface exposed by // this class: @@ -52,6 +51,8 @@ class Value; // - by default an "object" typed schema does not allow additional properties. // if present, "additionalProperties" is to be a schema against which all // additional properties will be validated. +// - regular expression supports all syntaxes that re2 accepts. +// See https://code.google.com/p/re2/wiki/Syntax for details. //============================================================================== class JSONSchemaValidator { public: @@ -92,6 +93,7 @@ class JSONSchemaValidator { static const char kNumberMaximum[]; static const char kInvalidType[]; static const char kInvalidTypeIntegerNumber[]; + static const char kInvalidRegex[]; // Classifies a Value as one of the JSON schema primitive types. static std::string GetJSONSchemaType(const base::Value* value); @@ -110,6 +112,10 @@ class JSONSchemaValidator { // and that DictionaryValue can be used to build a JSONSchemaValidator. // Returns the parsed DictionaryValue when |schema| validated, otherwise // returns NULL. In that case, |error| contains an error description. + // For performance reasons, currently IsValidSchema() won't check the + // correctness of regular expressions used in "pattern" and + // "patternProperties" and in Validate() invalid regular expression don't + // accept any strings. static scoped_ptr<base::DictionaryValue> IsValidSchema( const std::string& schema, std::string* error); |