summaryrefslogtreecommitdiffstats
path: root/tools/json_schema_compiler/idl_schema.py
diff options
context:
space:
mode:
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)