fixed #5692 and regenerated samples (#5698)

This commit is contained in:
rompic
2017-05-24 17:26:33 +02:00
committed by wing328
parent b024288df2
commit ef53f08b09
16 changed files with 145 additions and 112 deletions

View File

@@ -617,16 +617,17 @@ class ApiClient(object):
:param klass: class literal.
:return: model object.
"""
instance = klass()
if not instance.swagger_types:
if not klass.swagger_types:
return data
for attr, attr_type in iteritems(instance.swagger_types):
kwargs = {}
for attr, attr_type in iteritems(klass.swagger_types):
if data is not None \
and instance.attribute_map[attr] in data \
and klass.attribute_map[attr] in data \
and isinstance(data, (list, dict)):
value = data[instance.attribute_map[attr]]
setattr(instance, attr, self.__deserialize(value, attr_type))
value = data[klass.attribute_map[attr]]
kwargs[attr] = self.__deserialize(value, attr_type)
instance = klass(**kwargs)
return instance

View File

@@ -21,28 +21,30 @@ class ModelReturn(object):
NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
"""
Attributes:
swagger_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
swagger_types = {
'_return': 'int'
}
attribute_map = {
'_return': 'return'
}
def __init__(self, _return=None):
"""
ModelReturn - a model defined in Swagger
:param dict swaggerTypes: The key is attribute name
and the value is attribute type.
:param dict attributeMap: The key is attribute name
and the value is json key in definition.
"""
self.swagger_types = {
'_return': 'int'
}
self.attribute_map = {
'_return': 'return'
}
self.__return = None
# TODO: let required properties as mandatory parameter in the constructor.
# - to check if required property is not None (e.g. by calling setter)
# - ApiClient.__deserialize_model has to be adapted as well
if _return is not None:
self._return = _return