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

Unified Diff: tools/json_schema_compiler/cpp_type_generator.py

Issue 1051563002: Support JSON Schema properties with values in the JSON Schema Compiler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: assertr Created 5 years, 9 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
« no previous file with comments | « no previous file | tools/json_schema_compiler/idl_schema.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/json_schema_compiler/cpp_type_generator.py
diff --git a/tools/json_schema_compiler/cpp_type_generator.py b/tools/json_schema_compiler/cpp_type_generator.py
index 5a573b65a269f16f3cd05995fe2583028ef6a338..944dba9f1d88e203e60e4d06d37d0d9c4f990187 100644
--- a/tools/json_schema_compiler/cpp_type_generator.py
+++ b/tools/json_schema_compiler/cpp_type_generator.py
@@ -252,11 +252,15 @@ class CppTypeGenerator(object):
c.Comment(prop.description)
if prop.value is not None:
+ cpp_type = self.GetCppType(prop.type_)
+ cpp_value = prop.value
+ if cpp_type == 'std::string':
+ cpp_value = '"%s"' % cpp_type
c.Append(line % {
- "type": self.GetCppType(prop.type_),
- "name": prop.name,
- "value": prop.value
- })
+ "type": cpp_type,
+ "name": prop.name,
+ "value": cpp_value
+ })
else:
has_child_code = False
c.Sblock('namespace %s {' % prop.name)
« no previous file with comments | « no previous file | tools/json_schema_compiler/idl_schema.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698