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

Unified Diff: tools/json_schema_compiler/model.py

Issue 10828407: JSON Schema Compiler supports Enums as types. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: added a todo comment Created 8 years, 4 months 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 | « tools/json_schema_compiler/h_generator.py ('k') | tools/json_schema_compiler/test/enums.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/json_schema_compiler/model.py
diff --git a/tools/json_schema_compiler/model.py b/tools/json_schema_compiler/model.py
index e377295cd1529f4f0001f7e1ef978adb837882f3..753274f49f8544e2a90fbe439d73b17fdb109761 100644
--- a/tools/json_schema_compiler/model.py
+++ b/tools/json_schema_compiler/model.py
@@ -81,6 +81,11 @@ class Type(object):
from_client=True)
elif json.get('type') == 'string':
self.type_ = PropertyType.STRING
+ elif 'enum' in json:
+ self.enum_values = []
+ for value in json['enum']:
+ self.enum_values.append(value)
+ self.type_ = PropertyType.ENUM
else:
if not (
'properties' in json or
« no previous file with comments | « tools/json_schema_compiler/h_generator.py ('k') | tools/json_schema_compiler/test/enums.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698