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

@ -19,7 +19,7 @@ Method | HTTP request | Description
### Example
```python
from __future__ import print_statement
from __future__ import print_function
import time
import {{{packageName}}}
from {{{packageName}}}.rest import ApiException

View File

@ -14,7 +14,7 @@ To test code injection */ ' \" =end -- \\r\\n \\n \\r
### Example
```python
from __future__ import print_statement
from __future__ import print_function
import time
import petstore_api
from petstore_api.rest import ApiException

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

View File

@ -107,11 +107,9 @@ Class | Method | HTTP request | Description
- [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
- [ArrayTest](docs/ArrayTest.md)
- [Capitalization](docs/Capitalization.md)
- [Cat](docs/Cat.md)
- [Category](docs/Category.md)
- [ClassModel](docs/ClassModel.md)
- [Client](docs/Client.md)
- [Dog](docs/Dog.md)
- [EnumArrays](docs/EnumArrays.md)
- [EnumClass](docs/EnumClass.md)
- [EnumTest](docs/EnumTest.md)
@ -135,6 +133,8 @@ Class | Method | HTTP request | Description
- [SpecialModelName](docs/SpecialModelName.md)
- [Tag](docs/Tag.md)
- [User](docs/User.md)
- [Cat](docs/Cat.md)
- [Dog](docs/Dog.md)
## Documentation For Authorization

View File

@ -22,7 +22,7 @@ Test serialization of outer boolean types
### Example
```python
from __future__ import print_statement
from __future__ import print_function
import time
import petstore_api
from petstore_api.rest import ApiException
@ -69,7 +69,7 @@ Test serialization of object with outer number type
### Example
```python
from __future__ import print_statement
from __future__ import print_function
import time
import petstore_api
from petstore_api.rest import ApiException
@ -116,7 +116,7 @@ Test serialization of outer number types
### Example
```python
from __future__ import print_statement
from __future__ import print_function
import time
import petstore_api
from petstore_api.rest import ApiException
@ -163,7 +163,7 @@ Test serialization of outer string types
### Example
```python
from __future__ import print_statement
from __future__ import print_function
import time
import petstore_api
from petstore_api.rest import ApiException
@ -210,7 +210,7 @@ To test \"client\" model
### Example
```python
from __future__ import print_statement
from __future__ import print_function
import time
import petstore_api
from petstore_api.rest import ApiException
@ -258,7 +258,7 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン
### Example
```python
from __future__ import print_statement
from __future__ import print_function
import time
import petstore_api
from petstore_api.rest import ApiException
@ -335,7 +335,7 @@ To test enum parameters
### Example
```python
from __future__ import print_statement
from __future__ import print_function
import time
import petstore_api
from petstore_api.rest import ApiException

View File

@ -23,7 +23,7 @@ Add a new pet to the store
### Example
```python
from __future__ import print_statement
from __future__ import print_function
import time
import petstore_api
from petstore_api.rest import ApiException
@ -73,7 +73,7 @@ Deletes a pet
### Example
```python
from __future__ import print_statement
from __future__ import print_function
import time
import petstore_api
from petstore_api.rest import ApiException
@ -125,7 +125,7 @@ Multiple status values can be provided with comma separated strings
### Example
```python
from __future__ import print_statement
from __future__ import print_function
import time
import petstore_api
from petstore_api.rest import ApiException
@ -176,7 +176,7 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3
### Example
```python
from __future__ import print_statement
from __future__ import print_function
import time
import petstore_api
from petstore_api.rest import ApiException
@ -227,7 +227,7 @@ Returns a single pet
### Example
```python
from __future__ import print_statement
from __future__ import print_function
import time
import petstore_api
from petstore_api.rest import ApiException
@ -280,7 +280,7 @@ Update an existing pet
### Example
```python
from __future__ import print_statement
from __future__ import print_function
import time
import petstore_api
from petstore_api.rest import ApiException
@ -330,7 +330,7 @@ Updates a pet in the store with form data
### Example
```python
from __future__ import print_statement
from __future__ import print_function
import time
import petstore_api
from petstore_api.rest import ApiException
@ -384,7 +384,7 @@ uploads an image
### Example
```python
from __future__ import print_statement
from __future__ import print_function
import time
import petstore_api
from petstore_api.rest import ApiException

View File

@ -19,7 +19,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non
### Example
```python
from __future__ import print_statement
from __future__ import print_function
import time
import petstore_api
from petstore_api.rest import ApiException
@ -66,7 +66,7 @@ Returns a map of status codes to quantities
### Example
```python
from __future__ import print_statement
from __future__ import print_function
import time
import petstore_api
from petstore_api.rest import ApiException
@ -115,7 +115,7 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge
### Example
```python
from __future__ import print_statement
from __future__ import print_function
import time
import petstore_api
from petstore_api.rest import ApiException
@ -163,7 +163,7 @@ Place an order for a pet
### Example
```python
from __future__ import print_statement
from __future__ import print_function
import time
import petstore_api
from petstore_api.rest import ApiException

View File

@ -23,7 +23,7 @@ This can only be done by the logged in user.
### Example
```python
from __future__ import print_statement
from __future__ import print_function
import time
import petstore_api
from petstore_api.rest import ApiException
@ -70,7 +70,7 @@ Creates list of users with given input array
### Example
```python
from __future__ import print_statement
from __future__ import print_function
import time
import petstore_api
from petstore_api.rest import ApiException
@ -117,7 +117,7 @@ Creates list of users with given input array
### Example
```python
from __future__ import print_statement
from __future__ import print_function
import time
import petstore_api
from petstore_api.rest import ApiException
@ -164,7 +164,7 @@ This can only be done by the logged in user.
### Example
```python
from __future__ import print_statement
from __future__ import print_function
import time
import petstore_api
from petstore_api.rest import ApiException
@ -211,7 +211,7 @@ Get user by user name
### Example
```python
from __future__ import print_statement
from __future__ import print_function
import time
import petstore_api
from petstore_api.rest import ApiException
@ -259,7 +259,7 @@ Logs user into the system
### Example
```python
from __future__ import print_statement
from __future__ import print_function
import time
import petstore_api
from petstore_api.rest import ApiException
@ -309,7 +309,7 @@ Logs out current logged in user session
### Example
```python
from __future__ import print_statement
from __future__ import print_function
import time
import petstore_api
from petstore_api.rest import ApiException
@ -352,7 +352,7 @@ This can only be done by the logged in user.
### Example
```python
from __future__ import print_statement
from __future__ import print_function
import time
import petstore_api
from petstore_api.rest import ApiException

View File

@ -22,11 +22,9 @@ from .models.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly
from .models.array_of_number_only import ArrayOfNumberOnly
from .models.array_test import ArrayTest
from .models.capitalization import Capitalization
from .models.cat import Cat
from .models.category import Category
from .models.class_model import ClassModel
from .models.client import Client
from .models.dog import Dog
from .models.enum_arrays import EnumArrays
from .models.enum_class import EnumClass
from .models.enum_test import EnumTest
@ -50,6 +48,8 @@ from .models.read_only_first import ReadOnlyFirst
from .models.special_model_name import SpecialModelName
from .models.tag import Tag
from .models.user import User
from .models.cat import Cat
from .models.dog import Dog
# import apis into sdk package
from .apis.fake_api import FakeApi

View File

@ -105,7 +105,7 @@ class FakeApi(object):
path_params = {}
query_params = {}
query_params = []
header_params = {}
@ -198,7 +198,7 @@ class FakeApi(object):
path_params = {}
query_params = {}
query_params = []
header_params = {}
@ -291,7 +291,7 @@ class FakeApi(object):
path_params = {}
query_params = {}
query_params = []
header_params = {}
@ -384,7 +384,7 @@ class FakeApi(object):
path_params = {}
query_params = {}
query_params = []
header_params = {}

View File

@ -22,11 +22,9 @@ from .array_of_array_of_number_only import ArrayOfArrayOfNumberOnly
from .array_of_number_only import ArrayOfNumberOnly
from .array_test import ArrayTest
from .capitalization import Capitalization
from .cat import Cat
from .category import Category
from .class_model import ClassModel
from .client import Client
from .dog import Dog
from .enum_arrays import EnumArrays
from .enum_class import EnumClass
from .enum_test import EnumTest
@ -50,3 +48,5 @@ from .read_only_first import ReadOnlyFirst
from .special_model_name import SpecialModelName
from .tag import Tag
from .user import User
from .cat import Cat
from .dog import Dog

View File

@ -21,22 +21,28 @@ class OuterBoolean(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 = {
}
attribute_map = {
}
def __init__(self):
"""
OuterBoolean - 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 = {
}
self.attribute_map = {
}
def to_dict(self):

View File

@ -21,30 +21,42 @@ class OuterComposite(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 = {
'my_number': 'OuterNumber',
'my_string': 'OuterString',
'my_boolean': 'OuterBoolean'
}
attribute_map = {
'my_number': 'my_number',
'my_string': 'my_string',
'my_boolean': 'my_boolean'
}
def __init__(self, my_number=None, my_string=None, my_boolean=None):
"""
OuterComposite - 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 = {
'my_number': 'OuterNumber',
'my_string': 'OuterString',
'my_boolean': 'OuterBoolean'
}
self.attribute_map = {
'my_number': 'my_number',
'my_string': 'my_string',
'my_boolean': 'my_boolean'
}
self._my_number = None
self._my_string = None
self._my_boolean = None
self._my_number = my_number
self._my_string = my_string
self._my_boolean = my_boolean
if my_number is not None:
self.my_number = my_number
if my_string is not None:
self.my_string = my_string
if my_boolean is not None:
self.my_boolean = my_boolean
@property
def my_number(self):

View File

@ -21,22 +21,28 @@ class OuterNumber(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 = {
}
attribute_map = {
}
def __init__(self):
"""
OuterNumber - 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 = {
}
self.attribute_map = {
}
def to_dict(self):

View File

@ -21,22 +21,28 @@ class OuterString(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 = {
}
attribute_map = {
}
def __init__(self):
"""
OuterString - 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 = {
}
self.attribute_map = {
}
def to_dict(self):