summaryrefslogtreecommitdiffstats
path: root/tools/json_schema_compiler/idl_schema.py
diff options
context:
space:
mode:
authorevan.peterson.EP@gmail.com <evan.peterson.EP@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-23 04:24:55 +0000
committerevan.peterson.EP@gmail.com <evan.peterson.EP@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-23 04:24:55 +0000
commit8426f8d77f00969b40a39f4d3b58f545e36ac9b3 (patch)
treed36927b36e91387b08e038f83cab194d9301aae4 /tools/json_schema_compiler/idl_schema.py
parent424088849de595795caeb5d947764021681114ba (diff)
downloadchromium_src-8426f8d77f00969b40a39f4d3b58f545e36ac9b3.zip
chromium_src-8426f8d77f00969b40a39f4d3b58f545e36ac9b3.tar.gz
chromium_src-8426f8d77f00969b40a39f4d3b58f545e36ac9b3.tar.bz2
Add descriptions to all extension/app schemas, and enforce that they have them
from now on. BUG=233968 R=kalman@chromium.org TBR=yoz@chromium.org Review URL: https://chromiumcodereview.appspot.com/16876004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@208110 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/json_schema_compiler/idl_schema.py')
-rw-r--r--tools/json_schema_compiler/idl_schema.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/tools/json_schema_compiler/idl_schema.py b/tools/json_schema_compiler/idl_schema.py
index 519ae56..8197f31 100644
--- a/tools/json_schema_compiler/idl_schema.py
+++ b/tools/json_schema_compiler/idl_schema.py
@@ -309,7 +309,7 @@ class Namespace(object):
dictionary that the JSON schema compiler expects to see.
'''
- def __init__(self, namespace_node, nodoc=False, internal=False):
+ def __init__(self, namespace_node, description, nodoc=False, internal=False):
self.namespace = namespace_node
self.nodoc = nodoc
self.internal = internal
@@ -317,6 +317,7 @@ class Namespace(object):
self.functions = []
self.types = []
self.callbacks = OrderedDict()
+ self.description = description
def process(self):
for node in self.namespace.children:
@@ -334,6 +335,7 @@ class Namespace(object):
else:
sys.exit('Did not process %s %s' % (node.cls, node))
return {'namespace': self.namespace.GetName(),
+ 'description': self.description,
'nodoc': self.nodoc,
'types': self.types,
'functions': self.functions,
@@ -361,16 +363,20 @@ class IDLSchema(object):
namespaces = []
nodoc = False
internal = False
+ description = None
for node in self.idl:
if node.cls == 'Namespace':
- namespace = Namespace(node, nodoc, internal)
+ if not description:
+ raise ValueError('%s must have a namespace-level comment. This will '
+ 'appear on the API summary page.' % node.GetName())
+ namespace = Namespace(node, description, nodoc, internal)
namespaces.append(namespace.process())
nodoc = False
internal = False
elif node.cls == 'Copyright':
continue
elif node.cls == 'Comment':
- continue
+ description = node.GetName()
elif node.cls == 'ExtAttribute':
if node.name == 'nodoc':
nodoc = bool(node.value)