SEBA-513 Cleanup errors reported by xproto validator
Change-Id: I081534669a8b2ff542dfe9548847f5ff40a47643
diff --git a/lib/xos-genx/xosgenx/jinja2_extensions/tosca.py b/lib/xos-genx/xosgenx/jinja2_extensions/tosca.py
index b6ae85d..947be4f 100644
--- a/lib/xos-genx/xosgenx/jinja2_extensions/tosca.py
+++ b/lib/xos-genx/xosgenx/jinja2_extensions/tosca.py
@@ -19,7 +19,8 @@
def xproto_tosca_required(null, blank, default=None, modifier=None):
# `null` is not currently considered. `blank` is deprecated.
if (modifier == "optional") or (blank == "True") or (default is not None):
- return "false"
+ return "false"
+
return "true"
diff --git a/lib/xos-genx/xosgenx/validator.py b/lib/xos-genx/xosgenx/validator.py
index 3007a1a..772b0f9 100644
--- a/lib/xos-genx/xosgenx/validator.py
+++ b/lib/xos-genx/xosgenx/validator.py
@@ -125,8 +125,9 @@
def require_options(self, model, field, options):
""" Require an option to be present.
"""
+ options = field.get("options", {})
for optname in options:
- if not field.get(optname):
+ if optname not in options:
self.error(model, field, "Required option '%s' is not present" % optname)
def check_modifier_consistent(self, model, field):