I have a toplevel object schema-definition that, within the "properties" dict, has a item that is defined as:
"operation_mode": {
"default": "fullControl",
"x-scope": [
"https://172.20.20.3"
],
"$ref": "#/definitions/Type2"
}
And the Type2 definition is defined as:
{
"enum": [
"telemetryOnly",
"fullControl"
],
"type": "string",
}
When I attempt to build the toplevel object schema, the library is attempting to initialize this value to None, per this code. As a result, an exception is raised because this value must be in the enum list, and not None.
Perhaps I have my schema wrong; so if there is something I should correct please do let me know.
I've patched my local copy of this library to change the default setting value to:
def __init__(self, **props):
self._extended_properties = dict()
self._properties = dict(zip(self.__prop_names__.values(),
[None for x in
six.moves.xrange(len(self.__prop_names__))]))
# To support defaults, we have to actually execute the constructors
# but only for the ones that have defaults set.
for name in self.__has_default__:
if name not in props:
default_value = self.__propinfo__[name]['default']
logger.debug(util.lazy_format("Initializing '{0}' to '{1}'", name, default_value))
setattr(self, name, default_value)
If this is the "proper fix", then I would be happy to make a pull-request with this fix.
Please advise.
Thank you!
-- Jeremy
I have a toplevel object schema-definition that, within the "properties" dict, has a item that is defined as:
And the
Type2definition is defined as:When I attempt to build the toplevel object schema, the library is attempting to initialize this value to None, per this code. As a result, an exception is raised because this value must be in the enum list, and not
None.Perhaps I have my schema wrong; so if there is something I should correct please do let me know.
I've patched my local copy of this library to change the default setting value to:
If this is the "proper fix", then I would be happy to make a pull-request with this fix.
Please advise.
Thank you!
-- Jeremy