diff options
author | kalman@chromium.org <kalman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-17 06:33:30 +0000 |
---|---|---|
committer | kalman@chromium.org <kalman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-17 06:33:30 +0000 |
commit | 4b3f785c8deec47038bdad67fd13d8e48df756bf (patch) | |
tree | 11a86963b35b361e01f84b7857e01be873d54732 /tools/json_schema_compiler | |
parent | 56adf6874a3a93f8faaaa8ea8d0d38c7549a1f3a (diff) | |
download | chromium_src-4b3f785c8deec47038bdad67fd13d8e48df756bf.zip chromium_src-4b3f785c8deec47038bdad67fd13d8e48df756bf.tar.gz chromium_src-4b3f785c8deec47038bdad67fd13d8e48df756bf.tar.bz2 |
JSON schema compiler: Read the "optional" property out of the JSON for Function.
Without this, code that looks for the "callback" in a Function, and is
interested in whether it's optional (e.g. the new docs server) won't work.
TBR=mtytel@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10780027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146957 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/json_schema_compiler')
-rw-r--r-- | tools/json_schema_compiler/model.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/json_schema_compiler/model.py b/tools/json_schema_compiler/model.py index 828481f..a35d15e 100644 --- a/tools/json_schema_compiler/model.py +++ b/tools/json_schema_compiler/model.py @@ -114,12 +114,15 @@ class Function(object): - |description| a description of the function (if provided) - |callback| the callback parameter to the function. There should be exactly one + - |optional| whether the Function is "optional"; this only makes sense to be + present when the Function is representing a callback property. """ def __init__(self, parent, json, from_json=False, from_client=False): self.name = json['name'] self.params = [] self.description = json.get('description') self.callback = None + self.optional = json.get('optional', False) self.parent = parent self.nocompile = json.get('nocompile') for param in json.get('parameters', []): |