[CORD-1492] Adding tosca related functions in xosgenx jinja functions
Change-Id: I1ba1f5874a984a30645aa31a190dcd64d99b0938
diff --git a/lib/xos-genx/xosgenx/jinja2_extensions.py b/lib/xos-genx/xosgenx/jinja2_extensions.py
index 8377d5a..f07aa14 100644
--- a/lib/xos-genx/xosgenx/jinja2_extensions.py
+++ b/lib/xos-genx/xosgenx/jinja2_extensions.py
@@ -429,8 +429,18 @@
return options_str
-def xproto_tosca_required(blank):
- if blank == "False":
- return "true"
- return "false"
+def xproto_tosca_required(null, blank, default=None):
+
+ if null == 'True' or blank == 'True' or default != 'False':
+ return "false"
+ return "true"
+
+def xproto_tosca_field_type(type):
+ """
+ TOSCA requires fields of type 'bool' to be 'boolean'
+ """
+ if type == "bool":
+ return "boolean"
+ else:
+ return type