Make json_schema_compiler remove 'nocompile' nodes from JSON at the JSON level
rather than at the model level. This gives us automatic nocompile of all
properties; previously not all were supported.
TEST=tools/json_schema_compiler/json_schema_test.py, unit_tests --gtest_filter=JsonSchemaCompiler*
Review URL: http://codereview.chromium.org/10108005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132514 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/tools/json_schema_compiler/model.py b/tools/json_schema_compiler/model.py
index 53b3aee1..9a5c55f 100644
--- a/tools/json_schema_compiler/model.py
+++ b/tools/json_schema_compiler/model.py
@@ -16,12 +16,8 @@
self.namespaces = {}
def AddNamespace(self, json, source_file):
- """Add a namespace's json to the model if it doesn't have "nocompile"
- property set to true. Returns the new namespace or None if a namespace
- wasn't added.
+ """Add a namespace's json to the model and returns the namespace.
"""
- if json.get('nocompile', False):
- return None
namespace = Namespace(json, source_file)
self.namespaces[namespace.name] = namespace
return namespace
@@ -54,8 +50,7 @@
type_ = Type(self, type_json['id'], type_json)
self.types[type_.name] = type_
for function_json in json.get('functions', []):
- if not function_json.get('nocompile', False):
- self.functions[function_json['name']] = Function(self, function_json)
+ self.functions[function_json['name']] = Function(self, function_json)
class Type(object):
"""A Type defined in the json.
@@ -94,8 +89,7 @@
self.functions = {}
self.parent = parent
for function_json in json.get('functions', []):
- if not function_json.get('nocompile', False):
- self.functions[function_json['name']] = Function(self, function_json)
+ self.functions[function_json['name']] = Function(self, function_json)
props = []
for prop_name, prop_json in json.get('properties', {}).items():
# TODO(calamity): support functions (callbacks) as properties. The model