Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Unified Diff: tools/json_schema_compiler/js_util.py

Issue 2601333002: Update json_schema_compiler to handle the Automation extension API (Closed)
Patch Set: Optional to nullable Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/json_schema_compiler/js_util.py
diff --git a/tools/json_schema_compiler/js_util.py b/tools/json_schema_compiler/js_util.py
index 2549aefa2fae4966eee2c0f1fe4fef67667b82a7..60c52626c316bc3410b17b6818b48c377c35f052 100644
--- a/tools/json_schema_compiler/js_util.py
+++ b/tools/json_schema_compiler/js_util.py
@@ -101,6 +101,18 @@ class JsUtil(object):
c.Eblock(' */')
+ def AppendTypeJsDoc(self, c, namespace_name, js_type, nullable):
+ """Appends the documentation for a type as a Code.
+ """
+ c.Append('@type {')
+ js_type_str = self._TypeToJsType(namespace_name, js_type).Render()
+ if nullable:
+ if js_type_str[0] == '!':
+ js_type_str = js_type_str[1:]
+ js_type_str = '?' + js_type_str
Devlin 2017/01/12 17:28:48 Note: This means the possible values for the type
dmazzoni 2017/01/13 21:22:54 You're totally right. Pretty much everything retu
+ c.Append(js_type_str, new_line=False)
+ c.Append('}', new_line=False)
+
def _FunctionToJsFunction(self, namespace_name, function):
"""Converts a model.Function to a JS type (i.e., function([params])...)"""
c = Code()

Powered by Google App Engine
This is Rietveld 408576698