update python petstore samples

This commit is contained in:
wing328
2018-02-22 20:59:45 +08:00
parent edf6be8c07
commit b4827beba4
31 changed files with 574 additions and 28 deletions

View File

@@ -1 +1 @@
2.3.0-SNAPSHOT
2.4.0-SNAPSHOT

View File

@@ -273,10 +273,10 @@ configuration.password = 'YOUR_PASSWORD'
# create an instance of the API class
api_instance = petstore_api.FakeApi(petstore_api.ApiClient(configuration))
number = 3.4 # float | None
number = 8.14 # float | None
double = 1.2 # float | None
pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None
byte = 'byte_example' # str | None
byte = 'B' # str | None
integer = 56 # int | None (optional)
int32 = 56 # int | None (optional)
int64 = 789 # int | None (optional)

View File

@@ -12,6 +12,8 @@ Method | HTTP request | Description
To test class name in snake case
To test class name in snake case
### Example
```python
from __future__ import print_function

View File

@@ -219,7 +219,7 @@ from pprint import pprint
# create an instance of the API class
api_instance = petstore_api.UserApi()
username = 'username_example' # str | The name that needs to be fetched. Use user1 for testing.
username = 'username_example' # str | The name that needs to be fetched. Use user1 for testing.
try:
# Get user by user name
@@ -233,7 +233,7 @@ except ApiException as e:
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**username** | **str**| The name that needs to be fetched. Use user1 for testing. |
**username** | **str**| The name that needs to be fetched. Use user1 for testing. |
### Return type

View File

@@ -46,7 +46,7 @@ from petstore_api.models.has_only_read_only import HasOnlyReadOnly
from petstore_api.models.list import List
from petstore_api.models.map_test import MapTest
from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass
from petstore_api.models.model_200_response import Model200Response
from petstore_api.models.model200_response import Model200Response
from petstore_api.models.model_return import ModelReturn
from petstore_api.models.name import Name
from petstore_api.models.number_only import NumberOnly

View File

@@ -36,6 +36,7 @@ class FakeClassnameTags123Api(object):
def test_classname(self, body, **kwargs): # noqa: E501
"""To test class name in snake case # noqa: E501
To test class name in snake case # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.test_classname(body, async=True)
@@ -57,6 +58,7 @@ class FakeClassnameTags123Api(object):
def test_classname_with_http_info(self, body, **kwargs): # noqa: E501
"""To test class name in snake case # noqa: E501
To test class name in snake case # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.test_classname_with_http_info(body, async=True)

View File

@@ -423,7 +423,7 @@ class UserApi(object):
>>> result = thread.get()
:param async bool
:param str username: The name that needs to be fetched. Use user1 for testing. (required)
:param str username: The name that needs to be fetched. Use user1 for testing. (required)
:return: User
If the method is called asynchronously,
returns the request thread.
@@ -445,7 +445,7 @@ class UserApi(object):
>>> result = thread.get()
:param async bool
:param str username: The name that needs to be fetched. Use user1 for testing. (required)
:param str username: The name that needs to be fetched. Use user1 for testing. (required)
:return: User
If the method is called asynchronously,
returns the request thread.

View File

@@ -34,7 +34,7 @@ from petstore_api.models.has_only_read_only import HasOnlyReadOnly
from petstore_api.models.list import List
from petstore_api.models.map_test import MapTest
from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass
from petstore_api.models.model_200_response import Model200Response
from petstore_api.models.model200_response import Model200Response
from petstore_api.models.model_return import ModelReturn
from petstore_api.models.name import Name
from petstore_api.models.number_only import NumberOnly

View File

@@ -0,0 +1,138 @@
# coding: utf-8
"""
Swagger Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
OpenAPI spec version: 1.0.0
Contact: apiteam@swagger.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class Model200Response(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 = {
'name': 'int',
'_class': 'str'
}
attribute_map = {
'name': 'name',
'_class': 'class'
}
def __init__(self, name=None, _class=None): # noqa: E501
"""Model200Response - a model defined in Swagger""" # noqa: E501
self._name = None
self.__class = None
self.discriminator = None
if name is not None:
self.name = name
if _class is not None:
self._class = _class
@property
def name(self):
"""Gets the name of this Model200Response. # noqa: E501
:return: The name of this Model200Response. # noqa: E501
:rtype: int
"""
return self._name
@name.setter
def name(self, name):
"""Sets the name of this Model200Response.
:param name: The name of this Model200Response. # noqa: E501
:type: int
"""
self._name = name
@property
def _class(self):
"""Gets the _class of this Model200Response. # noqa: E501
:return: The _class of this Model200Response. # noqa: E501
:rtype: str
"""
return self.__class
@_class.setter
def _class(self, _class):
"""Sets the _class of this Model200Response.
:param _class: The _class of this Model200Response. # noqa: E501
:type: str
"""
self.__class = _class
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, Model200Response):
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""Returns true if both objects are not equal"""
return not self == other

View File

@@ -0,0 +1,40 @@
# coding: utf-8
"""
Swagger Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
OpenAPI spec version: 1.0.0
Contact: apiteam@swagger.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import petstore_api
from petstore_api.models.model200_response import Model200Response # noqa: E501
from petstore_api.rest import ApiException
class TestModel200Response(unittest.TestCase):
"""Model200Response unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def testModel200Response(self):
"""Test Model200Response"""
# FIXME: construct object with mandatory attributes with example values
# model = petstore_api.models.model200_response.Model200Response() # noqa: E501
pass
if __name__ == '__main__':
unittest.main()