summaryrefslogtreecommitdiffstats
path: root/tools/json_schema_compiler/idl_schema.py
diff options
context:
space:
mode:
authorasargent@chromium.org <asargent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-12 18:39:27 +0000
committerasargent@chromium.org <asargent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-12 18:39:27 +0000
commit4424aee1cf954aad998d2dd76e806e67841bae5c (patch)
tree7bdcaf921b1197e001fbdc6494536196ba03679c /tools/json_schema_compiler/idl_schema.py
parente9b26098616235783c9acc25421c46e800c34ac6 (diff)
downloadchromium_src-4424aee1cf954aad998d2dd76e806e67841bae5c.zip
chromium_src-4424aee1cf954aad998d2dd76e806e67841bae5c.tar.gz
chromium_src-4424aee1cf954aad998d2dd76e806e67841bae5c.tar.bz2
Support array types for function and callback arguments in IDL APIs.
I realized we completely omitted array support with our initial IDl work. This patch fixes that for 2 important cases, but doesn't yet add it in for dictionary members (that can be a separate patch). BUG=122875 TEST=Included unit tests should pass Review URL: http://codereview.chromium.org/10054039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132023 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/json_schema_compiler/idl_schema.py')
-rw-r--r--tools/json_schema_compiler/idl_schema.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/tools/json_schema_compiler/idl_schema.py b/tools/json_schema_compiler/idl_schema.py
index 9779e27..1d3c83a 100644
--- a/tools/json_schema_compiler/idl_schema.py
+++ b/tools/json_schema_compiler/idl_schema.py
@@ -108,10 +108,20 @@ class Typeref(object):
def process(self, refs):
properties = self.additional_properties
+ result = properties
if self.parent.GetProperty('OPTIONAL', False):
properties['optional'] = True
+ # The IDL parser denotes array types by adding a child 'Array' node onto
+ # the Param node in the Callspec.
+ for sibling in self.parent.GetChildren():
+ if sibling.cls == 'Array' and sibling.GetName() == self.parent.GetName():
+ properties['type'] = 'array'
+ properties['items'] = {}
+ properties = properties['items']
+ break
+
if self.typeref == 'DOMString':
properties['type'] = 'string'
elif self.typeref == 'boolean':
@@ -132,10 +142,11 @@ class Typeref(object):
properties['type'] = 'function'
else:
try:
- properties = refs[self.typeref]
+ result = refs[self.typeref]
except KeyError, e:
properties['$ref'] = self.typeref
- return properties
+
+ return result
class Namespace(object):
'''