forked from loafle/openapi-generator-original
[python-flask] Apply template tweaks to improve lint results (#6826)
The linting results for the generated samples are as follows where the first number is the BEFORE and the second is AFTER. flaskConnexion 1843 vs. 20 flaskConnexion-python2 1841 vs. 19 For the complete details please see the following gist. https://gist.github.com/kenjones-cisco/edc9d71ef7fd2bf23714ecbb693d52b3
This commit is contained in:
parent
f472b623f0
commit
28d14e34c4
@ -1,6 +1,7 @@
|
||||
# coding: utf-8
|
||||
|
||||
# flake8: noqa
|
||||
from __future__ import absolute_import
|
||||
# import models into model package
|
||||
{{#models}}{{#model}}from .{{classFilename}} import {{classname}}{{/model}}
|
||||
{{#models}}{{#model}}from {{modelPackage}}.{{classFilename}} import {{classname}}{{/model}}
|
||||
{{/models}}
|
@ -1,8 +1,10 @@
|
||||
from flask_testing import TestCase
|
||||
from ..encoder import JSONEncoder
|
||||
import connexion
|
||||
import logging
|
||||
|
||||
import connexion
|
||||
from flask_testing import TestCase
|
||||
|
||||
from {{packageName}}.encoder import JSONEncoder
|
||||
|
||||
|
||||
class BaseTestCase(TestCase):
|
||||
|
||||
|
@ -6,13 +6,14 @@
|
||||
{{/supportPython2}}
|
||||
|
||||
import connexion
|
||||
from .encoder import JSONEncoder
|
||||
|
||||
from {{packageName}} import encoder
|
||||
|
||||
|
||||
def main():
|
||||
app = connexion.App(__name__, specification_dir='./swagger/')
|
||||
app.app.json_encoder = JSONEncoder
|
||||
app.add_api('swagger.yaml', arguments={'title': '{{appDescription}}'})
|
||||
app.app.json_encoder = encoder.JSONEncoder
|
||||
app.add_api('swagger.yaml', arguments={'title': '{{appName}}'})
|
||||
app.run(port={{serverPort}})
|
||||
|
||||
|
||||
|
@ -1,38 +1,39 @@
|
||||
from pprint import pformat
|
||||
import pprint
|
||||
|
||||
import six
|
||||
{{^supportPython2}}
|
||||
from typing import TypeVar, Type
|
||||
import typing
|
||||
{{/supportPython2}}
|
||||
from six import iteritems
|
||||
from ..util import deserialize_model
|
||||
|
||||
from {{packageName}} import util
|
||||
{{^supportPython2}}
|
||||
|
||||
T = TypeVar('T')
|
||||
T = typing.TypeVar('T')
|
||||
{{/supportPython2}}
|
||||
|
||||
|
||||
class Model(object):
|
||||
# swaggerTypes: The key is attribute name and the value is attribute type.
|
||||
# swaggerTypes: The key is attribute name and the
|
||||
# value is attribute type.
|
||||
swagger_types = {}
|
||||
|
||||
# attributeMap: The key is attribute name and the value is json key in definition.
|
||||
# attributeMap: The key is attribute name and the
|
||||
# value is json key in definition.
|
||||
attribute_map = {}
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls{{^supportPython2}}: Type[T]{{/supportPython2}}, dikt){{^supportPython2}} -> T{{/supportPython2}}:
|
||||
"""
|
||||
Returns the dict as a model
|
||||
"""
|
||||
return deserialize_model(dikt, cls)
|
||||
def from_dict(cls{{^supportPython2}}: typing.Type[T]{{/supportPython2}}, dikt){{^supportPython2}} -> T{{/supportPython2}}:
|
||||
"""Returns the dict as a model"""
|
||||
return util.deserialize_model(dikt, cls)
|
||||
|
||||
def to_dict(self):
|
||||
"""
|
||||
Returns the model properties as a dict
|
||||
"""Returns the model properties as a dict
|
||||
|
||||
:rtype: dict
|
||||
"""
|
||||
result = {}
|
||||
|
||||
for attr, _ in iteritems(self.swagger_types):
|
||||
for attr, _ in six.iteritems(self.swagger_types):
|
||||
value = getattr(self, attr)
|
||||
if isinstance(value, list):
|
||||
result[attr] = list(map(
|
||||
@ -53,27 +54,20 @@ class Model(object):
|
||||
return result
|
||||
|
||||
def to_str(self):
|
||||
"""
|
||||
Returns the string representation of the model
|
||||
"""Returns the string representation of the model
|
||||
|
||||
:rtype: str
|
||||
"""
|
||||
return pformat(self.to_dict())
|
||||
return pprint.pformat(self.to_dict())
|
||||
|
||||
def __repr__(self):
|
||||
"""
|
||||
For `print` and `pprint`
|
||||
"""
|
||||
"""For `print` and `pprint`"""
|
||||
return self.to_str()
|
||||
|
||||
def __eq__(self, other):
|
||||
"""
|
||||
Returns true if both objects are equal
|
||||
"""
|
||||
"""Returns true if both objects are equal"""
|
||||
return self.__dict__ == other.__dict__
|
||||
|
||||
def __ne__(self, other):
|
||||
"""
|
||||
Returns true if both objects are not equal
|
||||
"""
|
||||
"""Returns true if both objects are not equal"""
|
||||
return not self == other
|
@ -1,18 +1,18 @@
|
||||
import connexion
|
||||
{{#imports}}{{import}}
|
||||
import six
|
||||
|
||||
{{#imports}}{{import}} # noqa: E501
|
||||
{{/imports}}
|
||||
from datetime import date, datetime
|
||||
from typing import List, Dict
|
||||
from six import iteritems
|
||||
from ..util import deserialize_date, deserialize_datetime
|
||||
from {{packageName}} import util
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
|
||||
|
||||
def {{operationId}}({{#allParams}}{{paramName}}{{^required}}=None{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}):
|
||||
"""
|
||||
{{#summary}}{{.}}{{/summary}}{{^summary}}{{operationId}}{{/summary}}
|
||||
{{#notes}}{{.}}{{/notes}}
|
||||
def {{operationId}}({{#allParams}}{{paramName}}{{^required}}=None{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}): # noqa: E501
|
||||
"""{{#summary}}{{.}}{{/summary}}{{^summary}}{{operationId}}{{/summary}}
|
||||
|
||||
{{#notes}}{{.}}{{/notes}} # noqa: E501
|
||||
|
||||
{{#allParams}}
|
||||
:param {{paramName}}: {{description}}
|
||||
{{^isContainer}}
|
||||
@ -55,15 +55,15 @@ def {{operationId}}({{#allParams}}{{paramName}}{{^required}}=None{{/required}}{{
|
||||
{{#allParams}}
|
||||
{{^isContainer}}
|
||||
{{#isDate}}
|
||||
{{paramName}} = deserialize_date({{paramName}})
|
||||
{{paramName}} = util.deserialize_date({{paramName}})
|
||||
{{/isDate}}
|
||||
{{#isDateTime}}
|
||||
{{paramName}} = deserialize_datetime({{paramName}})
|
||||
{{paramName}} = util.deserialize_datetime({{paramName}})
|
||||
{{/isDateTime}}
|
||||
{{^isPrimitiveType}}
|
||||
{{^isFile}}
|
||||
if connexion.request.is_json:
|
||||
{{paramName}} = {{baseType}}.from_dict(connexion.request.get_json())
|
||||
{{paramName}} = {{baseType}}.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
{{/isFile}}
|
||||
{{/isPrimitiveType}}
|
||||
{{/isContainer}}
|
||||
@ -71,15 +71,15 @@ def {{operationId}}({{#allParams}}{{paramName}}{{^required}}=None{{/required}}{{
|
||||
{{#items}}
|
||||
{{#isDate}}
|
||||
if connexion.request.is_json:
|
||||
{{paramName}} = [deserialize_date(s) for s in connexion.request.get_json()]
|
||||
{{paramName}} = [util.deserialize_date(s) for s in connexion.request.get_json()] # noqa: E501
|
||||
{{/isDate}}
|
||||
{{#isDateTime}}
|
||||
if connexion.request.is_json:
|
||||
{{paramName}} = [deserialize_datetime(s) for s in connexion.request.get_json()]
|
||||
{{paramName}} = [util.deserialize_datetime(s) for s in connexion.request.get_json()] # noqa: E501
|
||||
{{/isDateTime}}
|
||||
{{#complexType}}
|
||||
if connexion.request.is_json:
|
||||
{{paramName}} = [{{complexType}}.from_dict(d) for d in connexion.request.get_json()]
|
||||
{{paramName}} = [{{complexType}}.from_dict(d) for d in connexion.request.get_json()] # noqa: E501
|
||||
{{/complexType}}
|
||||
{{/items}}
|
||||
{{/isListContainer}}
|
||||
@ -87,15 +87,15 @@ def {{operationId}}({{#allParams}}{{paramName}}{{^required}}=None{{/required}}{{
|
||||
{{#items}}
|
||||
{{#isDate}}
|
||||
if connexion.request.is_json:
|
||||
{{paramName}} = {k: deserialize_date(v) for k, v in iteritems(connexion.request.get_json())}
|
||||
{{paramName}} = {k: util.deserialize_date(v) for k, v in six.iteritems(connexion.request.get_json())} # noqa: E501
|
||||
{{/isDate}}
|
||||
{{#isDateTime}}
|
||||
if connexion.request.is_json:
|
||||
{{paramName}} = {k: deserialize_datetime(v) for k, v in iteritems(connexion.request.get_json())}
|
||||
{{paramName}} = {k: util.deserialize_datetime(v) for k, v in six.iteritems(connexion.request.get_json())} # noqa: E501
|
||||
{{/isDateTime}}
|
||||
{{#complexType}}
|
||||
if connexion.request.is_json:
|
||||
{{paramName}} = {k: {{baseType}}.from_dict(v) for k, v in iteritems(connexion.request.get_json())}
|
||||
{{paramName}} = {k: {{baseType}}.from_dict(v) for k, v in six.iteritems(connexion.request.get_json())} # noqa: E501
|
||||
{{/complexType}}
|
||||
{{/items}}
|
||||
{{/isMapContainer}}
|
||||
|
@ -2,11 +2,12 @@
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
{{#imports}}{{import}}
|
||||
{{/imports}}
|
||||
from . import BaseTestCase
|
||||
from six import BytesIO
|
||||
from flask import json
|
||||
from six import BytesIO
|
||||
|
||||
{{#imports}}{{import}} # noqa: E501
|
||||
{{/imports}}
|
||||
from {{packageName}}.test import BaseTestCase
|
||||
|
||||
|
||||
class {{#operations}}Test{{classname}}(BaseTestCase):
|
||||
@ -14,8 +15,7 @@ class {{#operations}}Test{{classname}}(BaseTestCase):
|
||||
|
||||
{{#operation}}
|
||||
def test_{{operationId}}(self):
|
||||
"""
|
||||
Test case for {{{operationId}}}
|
||||
"""Test case for {{{operationId}}}
|
||||
|
||||
{{{summary}}}
|
||||
"""
|
||||
@ -31,7 +31,8 @@ class {{#operations}}Test{{classname}}(BaseTestCase):
|
||||
{{#formParams}}
|
||||
{{#-first}}data = dict({{/-first}}{{^-first}} {{/-first}}{{paramName}}={{{example}}}{{#hasMore}},{{/hasMore}}{{#-last}}){{/-last}}
|
||||
{{/formParams}}
|
||||
response = self.client.open('{{#contextPath}}{{{.}}}{{/contextPath}}{{{path}}}'{{#pathParams}}{{#-first}}.format({{/-first}}{{paramName}}={{{example}}}{{#hasMore}}, {{/hasMore}}{{^hasMore}}){{/hasMore}}{{/pathParams}},
|
||||
response = self.client.open(
|
||||
'{{#contextPath}}{{{.}}}{{/contextPath}}{{{path}}}'{{#pathParams}}{{#-first}}.format({{/-first}}{{paramName}}={{{example}}}{{#hasMore}}, {{/hasMore}}{{^hasMore}}){{/hasMore}}{{/pathParams}},
|
||||
method='{{httpMethod}}'{{#bodyParam}},
|
||||
data=json.dumps({{paramName}}){{^consumes}},
|
||||
content_type='application/json'{{/consumes}}{{/bodyParam}}{{#headerParams}}{{#-first}},
|
||||
@ -39,7 +40,8 @@ class {{#operations}}Test{{classname}}(BaseTestCase):
|
||||
data=data{{/-first}}{{/formParams}}{{#consumes}}{{#-first}},
|
||||
content_type='{{{mediaType}}}'{{/-first}}{{/consumes}}{{#queryParams}}{{#-first}},
|
||||
query_string=query_string{{/-first}}{{/queryParams}})
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
{{/operation}}
|
||||
{{/operations}}
|
||||
|
@ -1,6 +1,8 @@
|
||||
from six import iteritems
|
||||
from {{modelPackage}}.base_model_ import Model
|
||||
from connexion.apps.flask_app import FlaskJSONEncoder
|
||||
import six
|
||||
|
||||
from {{modelPackage}}.base_model_ import Model
|
||||
|
||||
|
||||
class JSONEncoder(FlaskJSONEncoder):
|
||||
include_nulls = False
|
||||
@ -8,7 +10,7 @@ class JSONEncoder(FlaskJSONEncoder):
|
||||
def default(self, o):
|
||||
if isinstance(o, Model):
|
||||
dikt = {}
|
||||
for attr, _ in iteritems(o.swagger_types):
|
||||
for attr, _ in six.iteritems(o.swagger_types):
|
||||
value = getattr(o, attr)
|
||||
if value is None and not self.include_nulls:
|
||||
continue
|
||||
|
@ -1,73 +1,74 @@
|
||||
# coding: utf-8
|
||||
|
||||
from __future__ import absolute_import
|
||||
{{#imports}}{{import}}
|
||||
from datetime import date, datetime # noqa: F401
|
||||
|
||||
from typing import List, Dict # noqa: F401
|
||||
|
||||
from {{modelPackage}}.base_model_ import Model
|
||||
{{#imports}}{{import}} # noqa: E501
|
||||
{{/imports}}
|
||||
from .base_model_ import Model
|
||||
from datetime import date, datetime
|
||||
from typing import List, Dict
|
||||
from ..util import deserialize_model
|
||||
from {{packageName}} import util
|
||||
|
||||
|
||||
{{#models}}
|
||||
{{#model}}
|
||||
class {{classname}}(Model):
|
||||
"""
|
||||
NOTE: This class is auto generated by the swagger code generator program.
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
"""NOTE: This class is auto generated by the swagger code generator program.
|
||||
|
||||
Do not edit the class manually.
|
||||
"""{{#allowableValues}}
|
||||
|
||||
{{#allowableValues}}
|
||||
"""
|
||||
allowed enum values
|
||||
"""
|
||||
{{#enumVars}}
|
||||
{{name}} = {{{value}}}
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
{{name}} = {{{value}}}{{^-last}}
|
||||
{{/-last}}
|
||||
{{/enumVars}}{{/allowableValues}}
|
||||
|
||||
def __init__(self{{#vars}}, {{name}}{{^supportPython2}}: {{datatype}}{{/supportPython2}}={{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}None{{/defaultValue}}{{/vars}}):
|
||||
"""
|
||||
{{classname}} - a model defined in Swagger
|
||||
def __init__(self{{#vars}}, {{name}}{{^supportPython2}}: {{datatype}}{{/supportPython2}}={{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}None{{/defaultValue}}{{/vars}}): # noqa: E501
|
||||
"""{{classname}} - a model defined in Swagger
|
||||
|
||||
{{#vars}}
|
||||
:param {{name}}: The {{name}} of this {{classname}}.
|
||||
:param {{name}}: The {{name}} of this {{classname}}. # noqa: E501
|
||||
:type {{name}}: {{datatype}}
|
||||
{{/vars}}
|
||||
"""
|
||||
self.swagger_types = {
|
||||
{{#vars}}'{{name}}': {{{datatype}}}{{#hasMore}},
|
||||
{{/hasMore}}{{/vars}}
|
||||
{{#vars}}
|
||||
'{{name}}': {{{datatype}}}{{#hasMore}},{{/hasMore}}
|
||||
{{/vars}}
|
||||
}
|
||||
|
||||
self.attribute_map = {
|
||||
{{#vars}}'{{name}}': '{{baseName}}'{{#hasMore}},
|
||||
{{/hasMore}}{{/vars}}
|
||||
}
|
||||
|
||||
{{#vars}}
|
||||
'{{name}}': '{{baseName}}'{{#hasMore}},{{/hasMore}}
|
||||
{{/vars}}
|
||||
}
|
||||
{{#vars}}{{#-first}}
|
||||
{{/-first}}
|
||||
self._{{name}} = {{name}}
|
||||
{{/vars}}
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, dikt){{^supportPython2}} -> '{{classname}}'{{/supportPython2}}:
|
||||
"""
|
||||
Returns the dict as a model
|
||||
"""Returns the dict as a model
|
||||
|
||||
:param dikt: A dict.
|
||||
:type: dict
|
||||
:return: The {{name}} of this {{classname}}.
|
||||
:return: The {{name}} of this {{classname}}. # noqa: E501
|
||||
:rtype: {{classname}}
|
||||
"""
|
||||
return deserialize_model(dikt, cls)
|
||||
{{#vars}}{{#-first}}
|
||||
return util.deserialize_model(dikt, cls){{#vars}}{{#-first}}
|
||||
|
||||
{{/-first}}
|
||||
@property
|
||||
def {{name}}(self){{^supportPython2}} -> {{datatype}}{{/supportPython2}}:
|
||||
"""
|
||||
Gets the {{name}} of this {{classname}}.
|
||||
"""Gets the {{name}} of this {{classname}}.
|
||||
|
||||
{{#description}}
|
||||
{{{description}}}
|
||||
{{{description}}} # noqa: E501
|
||||
{{/description}}
|
||||
|
||||
:return: The {{name}} of this {{classname}}.
|
||||
@ -77,31 +78,31 @@ class {{classname}}(Model):
|
||||
|
||||
@{{name}}.setter
|
||||
def {{name}}(self, {{name}}{{^supportPython2}}: {{datatype}}{{/supportPython2}}):
|
||||
"""
|
||||
Sets the {{name}} of this {{classname}}.
|
||||
"""Sets the {{name}} of this {{classname}}.
|
||||
|
||||
{{#description}}
|
||||
{{{description}}}
|
||||
{{{description}}} # noqa: E501
|
||||
{{/description}}
|
||||
|
||||
:param {{name}}: The {{name}} of this {{classname}}.
|
||||
:type {{name}}: {{datatype}}
|
||||
"""
|
||||
{{#isEnum}}
|
||||
allowed_values = [{{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}]
|
||||
allowed_values = [{{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}] # noqa: E501
|
||||
{{#isContainer}}
|
||||
{{#isListContainer}}
|
||||
if not set({{{name}}}).issubset(set(allowed_values)):
|
||||
raise ValueError(
|
||||
"Invalid values for `{{{name}}}` [{0}], must be a subset of [{1}]"
|
||||
.format(", ".join(map(str, set({{{name}}})-set(allowed_values))),
|
||||
"Invalid values for `{{{name}}}` [{0}], must be a subset of [{1}]" # noqa: E501
|
||||
.format(", ".join(map(str, set({{{name}}})-set(allowed_values))), # noqa: E501
|
||||
", ".join(map(str, allowed_values)))
|
||||
)
|
||||
{{/isListContainer}}
|
||||
{{#isMapContainer}}
|
||||
if not set({{{name}}}.keys()).issubset(set(allowed_values)):
|
||||
raise ValueError(
|
||||
"Invalid keys in `{{{name}}}` [{0}], must be a subset of [{1}]"
|
||||
.format(", ".join(map(str, set({{{name}}}.keys())-set(allowed_values))),
|
||||
"Invalid keys in `{{{name}}}` [{0}], must be a subset of [{1}]" # noqa: E501
|
||||
.format(", ".join(map(str, set({{{name}}}.keys())-set(allowed_values))), # noqa: E501
|
||||
", ".join(map(str, allowed_values)))
|
||||
)
|
||||
{{/isMapContainer}}
|
||||
@ -117,42 +118,44 @@ class {{classname}}(Model):
|
||||
{{^isEnum}}
|
||||
{{#required}}
|
||||
if {{name}} is None:
|
||||
raise ValueError("Invalid value for `{{name}}`, must not be `None`")
|
||||
raise ValueError("Invalid value for `{{name}}`, must not be `None`") # noqa: E501
|
||||
{{/required}}
|
||||
{{#hasValidation}}
|
||||
{{#maxLength}}
|
||||
if {{name}} is not None and len({{name}}) > {{maxLength}}:
|
||||
raise ValueError("Invalid value for `{{name}}`, length must be less than or equal to `{{maxLength}}`")
|
||||
raise ValueError("Invalid value for `{{name}}`, length must be less than or equal to `{{maxLength}}`") # noqa: E501
|
||||
{{/maxLength}}
|
||||
{{#minLength}}
|
||||
if {{name}} is not None and len({{name}}) < {{minLength}}:
|
||||
raise ValueError("Invalid value for `{{name}}`, length must be greater than or equal to `{{minLength}}`")
|
||||
raise ValueError("Invalid value for `{{name}}`, length must be greater than or equal to `{{minLength}}`") # noqa: E501
|
||||
{{/minLength}}
|
||||
{{#maximum}}
|
||||
if {{name}} is not None and {{name}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}}:
|
||||
raise ValueError("Invalid value for `{{name}}`, must be a value less than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}`{{maximum}}`")
|
||||
if {{name}} is not None and {{name}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}}: # noqa: E501
|
||||
raise ValueError("Invalid value for `{{name}}`, must be a value less than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}`{{maximum}}`") # noqa: E501
|
||||
{{/maximum}}
|
||||
{{#minimum}}
|
||||
if {{name}} is not None and {{name}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}}:
|
||||
raise ValueError("Invalid value for `{{name}}`, must be a value greater than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}`{{minimum}}`")
|
||||
if {{name}} is not None and {{name}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}}: # noqa: E501
|
||||
raise ValueError("Invalid value for `{{name}}`, must be a value greater than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}`{{minimum}}`") # noqa: E501
|
||||
{{/minimum}}
|
||||
{{#pattern}}
|
||||
if {{name}} is not None and not re.search('{{{vendorExtensions.x-regex}}}', {{name}}{{#vendorExtensions.x-modifiers}}{{#-first}}, flags={{/-first}}re.{{.}}{{^-last}} | {{/-last}}{{/vendorExtensions.x-modifiers}}):
|
||||
raise ValueError("Invalid value for `{{name}}`, must be a follow pattern or equal to `{{{pattern}}}`")
|
||||
if {{name}} is not None and not re.search('{{{vendorExtensions.x-regex}}}', {{name}}{{#vendorExtensions.x-modifiers}}{{#-first}}, flags={{/-first}}re.{{.}}{{^-last}} | {{/-last}}{{/vendorExtensions.x-modifiers}}): # noqa: E501
|
||||
raise ValueError("Invalid value for `{{name}}`, must be a follow pattern or equal to `{{{pattern}}}`") # noqa: E501
|
||||
{{/pattern}}
|
||||
{{#maxItems}}
|
||||
if {{name}} is not None and len({{name}}) > {{maxItems}}:
|
||||
raise ValueError("Invalid value for `{{name}}`, number of items must be less than or equal to `{{maxItems}}`")
|
||||
raise ValueError("Invalid value for `{{name}}`, number of items must be less than or equal to `{{maxItems}}`") # noqa: E501
|
||||
{{/maxItems}}
|
||||
{{#minItems}}
|
||||
if {{name}} is not None and len({{name}}) < {{minItems}}:
|
||||
raise ValueError("Invalid value for `{{name}}`, number of items must be greater than or equal to `{{minItems}}`")
|
||||
raise ValueError("Invalid value for `{{name}}`, number of items must be greater than or equal to `{{minItems}}`") # noqa: E501
|
||||
{{/minItems}}
|
||||
{{/hasValidation}}
|
||||
{{/isEnum}}
|
||||
|
||||
self._{{name}} = {{name}}
|
||||
self._{{name}} = {{name}}{{^-last}}
|
||||
|
||||
{{/-last}}
|
||||
{{/vars}}
|
||||
|
||||
{{/model}}
|
||||
{{/models}}
|
@ -1,11 +1,11 @@
|
||||
from typing import GenericMeta
|
||||
from datetime import datetime, date
|
||||
from six import integer_types, iteritems
|
||||
import datetime
|
||||
|
||||
import six
|
||||
import typing
|
||||
|
||||
|
||||
def _deserialize(data, klass):
|
||||
"""
|
||||
Deserializes dict, list, str into an object.
|
||||
"""Deserializes dict, list, str into an object.
|
||||
|
||||
:param data: dict, list or str.
|
||||
:param klass: class literal, or string of class name.
|
||||
@ -15,15 +15,15 @@ def _deserialize(data, klass):
|
||||
if data is None:
|
||||
return None
|
||||
|
||||
if klass in integer_types or klass in (float, str, bool):
|
||||
if klass in six.integer_types or klass in (float, str, bool):
|
||||
return _deserialize_primitive(data, klass)
|
||||
elif klass == object:
|
||||
return _deserialize_object(data)
|
||||
elif klass == date:
|
||||
elif klass == datetime.date:
|
||||
return deserialize_date(data)
|
||||
elif klass == datetime:
|
||||
elif klass == datetime.datetime:
|
||||
return deserialize_datetime(data)
|
||||
elif type(klass) == GenericMeta:
|
||||
elif type(klass) == typing.GenericMeta:
|
||||
if klass.__extra__ == list:
|
||||
return _deserialize_list(data, klass.__args__[0])
|
||||
if klass.__extra__ == dict:
|
||||
@ -33,8 +33,7 @@ def _deserialize(data, klass):
|
||||
|
||||
|
||||
def _deserialize_primitive(data, klass):
|
||||
"""
|
||||
Deserializes to primitive type.
|
||||
"""Deserializes to primitive type.
|
||||
|
||||
:param data: data to deserialize.
|
||||
:param klass: class literal.
|
||||
@ -52,8 +51,7 @@ def _deserialize_primitive(data, klass):
|
||||
|
||||
|
||||
def _deserialize_object(value):
|
||||
"""
|
||||
Return a original value.
|
||||
"""Return a original value.
|
||||
|
||||
:return: object.
|
||||
"""
|
||||
@ -61,8 +59,7 @@ def _deserialize_object(value):
|
||||
|
||||
|
||||
def deserialize_date(string):
|
||||
"""
|
||||
Deserializes string to date.
|
||||
"""Deserializes string to date.
|
||||
|
||||
:param string: str.
|
||||
:type string: str
|
||||
@ -77,8 +74,7 @@ def deserialize_date(string):
|
||||
|
||||
|
||||
def deserialize_datetime(string):
|
||||
"""
|
||||
Deserializes string to datetime.
|
||||
"""Deserializes string to datetime.
|
||||
|
||||
The string should be in iso8601 datetime format.
|
||||
|
||||
@ -95,8 +91,7 @@ def deserialize_datetime(string):
|
||||
|
||||
|
||||
def deserialize_model(data, klass):
|
||||
"""
|
||||
Deserializes list or dict to model.
|
||||
"""Deserializes list or dict to model.
|
||||
|
||||
:param data: dict, list.
|
||||
:type data: dict | list
|
||||
@ -108,7 +103,7 @@ def deserialize_model(data, klass):
|
||||
if not instance.swagger_types:
|
||||
return data
|
||||
|
||||
for attr, attr_type in iteritems(instance.swagger_types):
|
||||
for attr, attr_type in six.iteritems(instance.swagger_types):
|
||||
if data is not None \
|
||||
and instance.attribute_map[attr] in data \
|
||||
and isinstance(data, (list, dict)):
|
||||
@ -119,8 +114,7 @@ def deserialize_model(data, klass):
|
||||
|
||||
|
||||
def _deserialize_list(data, boxed_type):
|
||||
"""
|
||||
Deserializes a list and its elements.
|
||||
"""Deserializes a list and its elements.
|
||||
|
||||
:param data: list to deserialize.
|
||||
:type data: list
|
||||
@ -133,10 +127,8 @@ def _deserialize_list(data, boxed_type):
|
||||
for sub_data in data]
|
||||
|
||||
|
||||
|
||||
def _deserialize_dict(data, boxed_type):
|
||||
"""
|
||||
Deserializes a dict and its elements.
|
||||
"""Deserializes a dict and its elements.
|
||||
|
||||
:param data: dict to deserialize.
|
||||
:type data: dict
|
||||
@ -146,4 +138,4 @@ def _deserialize_dict(data, boxed_type):
|
||||
:rtype: dict
|
||||
"""
|
||||
return {k: _deserialize(v, boxed_type)
|
||||
for k, v in iteritems(data)}
|
||||
for k, v in six.iteritems(data)}
|
||||
|
@ -1,13 +1,14 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import connexion
|
||||
from .encoder import JSONEncoder
|
||||
|
||||
from swagger_server import encoder
|
||||
|
||||
|
||||
def main():
|
||||
app = connexion.App(__name__, specification_dir='./swagger/')
|
||||
app.app.json_encoder = JSONEncoder
|
||||
app.add_api('swagger.yaml', arguments={'title': 'This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.'})
|
||||
app.app.json_encoder = encoder.JSONEncoder
|
||||
app.add_api('swagger.yaml', arguments={'title': 'Swagger Petstore'})
|
||||
app.run(port=8080)
|
||||
|
||||
|
||||
|
@ -1,15 +1,15 @@
|
||||
import connexion
|
||||
from swagger_server.models.api_response import ApiResponse
|
||||
from swagger_server.models.pet import Pet
|
||||
from datetime import date, datetime
|
||||
from typing import List, Dict
|
||||
from six import iteritems
|
||||
from ..util import deserialize_date, deserialize_datetime
|
||||
import six
|
||||
|
||||
from swagger_server.models.api_response import ApiResponse # noqa: E501
|
||||
from swagger_server.models.pet import Pet # noqa: E501
|
||||
from swagger_server import util
|
||||
|
||||
|
||||
def add_pet(body):
|
||||
"""
|
||||
Add a new pet to the store
|
||||
def add_pet(body): # noqa: E501
|
||||
"""Add a new pet to the store
|
||||
|
||||
# noqa: E501
|
||||
|
||||
:param body: Pet object that needs to be added to the store
|
||||
:type body: dict | bytes
|
||||
@ -17,13 +17,14 @@ def add_pet(body):
|
||||
:rtype: None
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
body = Pet.from_dict(connexion.request.get_json())
|
||||
body = Pet.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def delete_pet(petId, api_key=None):
|
||||
"""
|
||||
Deletes a pet
|
||||
def delete_pet(petId, api_key=None): # noqa: E501
|
||||
"""Deletes a pet
|
||||
|
||||
# noqa: E501
|
||||
|
||||
:param petId: Pet id to delete
|
||||
:type petId: int
|
||||
@ -35,10 +36,11 @@ def delete_pet(petId, api_key=None):
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def find_pets_by_status(status):
|
||||
"""
|
||||
Finds Pets by status
|
||||
Multiple status values can be provided with comma separated strings
|
||||
def find_pets_by_status(status): # noqa: E501
|
||||
"""Finds Pets by status
|
||||
|
||||
Multiple status values can be provided with comma separated strings # noqa: E501
|
||||
|
||||
:param status: Status values that need to be considered for filter
|
||||
:type status: List[str]
|
||||
|
||||
@ -47,10 +49,11 @@ def find_pets_by_status(status):
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def find_pets_by_tags(tags):
|
||||
"""
|
||||
Finds Pets by tags
|
||||
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
def find_pets_by_tags(tags): # noqa: E501
|
||||
"""Finds Pets by tags
|
||||
|
||||
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. # noqa: E501
|
||||
|
||||
:param tags: Tags to filter by
|
||||
:type tags: List[str]
|
||||
|
||||
@ -59,10 +62,11 @@ def find_pets_by_tags(tags):
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def get_pet_by_id(petId):
|
||||
"""
|
||||
Find pet by ID
|
||||
Returns a single pet
|
||||
def get_pet_by_id(petId): # noqa: E501
|
||||
"""Find pet by ID
|
||||
|
||||
Returns a single pet # noqa: E501
|
||||
|
||||
:param petId: ID of pet to return
|
||||
:type petId: int
|
||||
|
||||
@ -71,9 +75,10 @@ def get_pet_by_id(petId):
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def update_pet(body):
|
||||
"""
|
||||
Update an existing pet
|
||||
def update_pet(body): # noqa: E501
|
||||
"""Update an existing pet
|
||||
|
||||
# noqa: E501
|
||||
|
||||
:param body: Pet object that needs to be added to the store
|
||||
:type body: dict | bytes
|
||||
@ -81,13 +86,14 @@ def update_pet(body):
|
||||
:rtype: None
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
body = Pet.from_dict(connexion.request.get_json())
|
||||
body = Pet.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def update_pet_with_form(petId, name=None, status=None):
|
||||
"""
|
||||
Updates a pet in the store with form data
|
||||
def update_pet_with_form(petId, name=None, status=None): # noqa: E501
|
||||
"""Updates a pet in the store with form data
|
||||
|
||||
# noqa: E501
|
||||
|
||||
:param petId: ID of pet that needs to be updated
|
||||
:type petId: int
|
||||
@ -101,9 +107,10 @@ def update_pet_with_form(petId, name=None, status=None):
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def upload_file(petId, additionalMetadata=None, file=None):
|
||||
"""
|
||||
uploads an image
|
||||
def upload_file(petId, additionalMetadata=None, file=None): # noqa: E501
|
||||
"""uploads an image
|
||||
|
||||
# noqa: E501
|
||||
|
||||
:param petId: ID of pet to update
|
||||
:type petId: int
|
||||
|
@ -1,15 +1,15 @@
|
||||
import connexion
|
||||
from swagger_server.models.order import Order
|
||||
from datetime import date, datetime
|
||||
from typing import List, Dict
|
||||
from six import iteritems
|
||||
from ..util import deserialize_date, deserialize_datetime
|
||||
import six
|
||||
|
||||
from swagger_server.models.order import Order # noqa: E501
|
||||
from swagger_server import util
|
||||
|
||||
|
||||
def delete_order(orderId):
|
||||
"""
|
||||
Delete purchase order by ID
|
||||
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
def delete_order(orderId): # noqa: E501
|
||||
"""Delete purchase order by ID
|
||||
|
||||
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors # noqa: E501
|
||||
|
||||
:param orderId: ID of the order that needs to be deleted
|
||||
:type orderId: str
|
||||
|
||||
@ -18,20 +18,22 @@ def delete_order(orderId):
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def get_inventory():
|
||||
"""
|
||||
Returns pet inventories by status
|
||||
Returns a map of status codes to quantities
|
||||
def get_inventory(): # noqa: E501
|
||||
"""Returns pet inventories by status
|
||||
|
||||
Returns a map of status codes to quantities # noqa: E501
|
||||
|
||||
|
||||
:rtype: Dict[str, int]
|
||||
"""
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def get_order_by_id(orderId):
|
||||
"""
|
||||
Find purchase order by ID
|
||||
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
def get_order_by_id(orderId): # noqa: E501
|
||||
"""Find purchase order by ID
|
||||
|
||||
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions # noqa: E501
|
||||
|
||||
:param orderId: ID of pet that needs to be fetched
|
||||
:type orderId: int
|
||||
|
||||
@ -40,9 +42,10 @@ def get_order_by_id(orderId):
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def place_order(body):
|
||||
"""
|
||||
Place an order for a pet
|
||||
def place_order(body): # noqa: E501
|
||||
"""Place an order for a pet
|
||||
|
||||
# noqa: E501
|
||||
|
||||
:param body: order placed for purchasing the pet
|
||||
:type body: dict | bytes
|
||||
@ -50,5 +53,5 @@ def place_order(body):
|
||||
:rtype: Order
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
body = Order.from_dict(connexion.request.get_json())
|
||||
body = Order.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
return 'do some magic!'
|
||||
|
@ -1,28 +1,29 @@
|
||||
import connexion
|
||||
from swagger_server.models.user import User
|
||||
from datetime import date, datetime
|
||||
from typing import List, Dict
|
||||
from six import iteritems
|
||||
from ..util import deserialize_date, deserialize_datetime
|
||||
import six
|
||||
|
||||
from swagger_server.models.user import User # noqa: E501
|
||||
from swagger_server import util
|
||||
|
||||
|
||||
def create_user(body):
|
||||
"""
|
||||
Create user
|
||||
This can only be done by the logged in user.
|
||||
def create_user(body): # noqa: E501
|
||||
"""Create user
|
||||
|
||||
This can only be done by the logged in user. # noqa: E501
|
||||
|
||||
:param body: Created user object
|
||||
:type body: dict | bytes
|
||||
|
||||
:rtype: None
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
body = User.from_dict(connexion.request.get_json())
|
||||
body = User.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def create_users_with_array_input(body):
|
||||
"""
|
||||
Creates list of users with given input array
|
||||
def create_users_with_array_input(body): # noqa: E501
|
||||
"""Creates list of users with given input array
|
||||
|
||||
# noqa: E501
|
||||
|
||||
:param body: List of user object
|
||||
:type body: list | bytes
|
||||
@ -30,13 +31,14 @@ def create_users_with_array_input(body):
|
||||
:rtype: None
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
body = [User.from_dict(d) for d in connexion.request.get_json()]
|
||||
body = [User.from_dict(d) for d in connexion.request.get_json()] # noqa: E501
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def create_users_with_list_input(body):
|
||||
"""
|
||||
Creates list of users with given input array
|
||||
def create_users_with_list_input(body): # noqa: E501
|
||||
"""Creates list of users with given input array
|
||||
|
||||
# noqa: E501
|
||||
|
||||
:param body: List of user object
|
||||
:type body: list | bytes
|
||||
@ -44,14 +46,15 @@ def create_users_with_list_input(body):
|
||||
:rtype: None
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
body = [User.from_dict(d) for d in connexion.request.get_json()]
|
||||
body = [User.from_dict(d) for d in connexion.request.get_json()] # noqa: E501
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def delete_user(username):
|
||||
"""
|
||||
Delete user
|
||||
This can only be done by the logged in user.
|
||||
def delete_user(username): # noqa: E501
|
||||
"""Delete user
|
||||
|
||||
This can only be done by the logged in user. # noqa: E501
|
||||
|
||||
:param username: The name that needs to be deleted
|
||||
:type username: str
|
||||
|
||||
@ -60,9 +63,10 @@ def delete_user(username):
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def get_user_by_name(username):
|
||||
"""
|
||||
Get user by user name
|
||||
def get_user_by_name(username): # noqa: E501
|
||||
"""Get user by user name
|
||||
|
||||
# noqa: E501
|
||||
|
||||
:param username: The name that needs to be fetched. Use user1 for testing.
|
||||
:type username: str
|
||||
@ -72,9 +76,10 @@ def get_user_by_name(username):
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def login_user(username, password):
|
||||
"""
|
||||
Logs user into the system
|
||||
def login_user(username, password): # noqa: E501
|
||||
"""Logs user into the system
|
||||
|
||||
# noqa: E501
|
||||
|
||||
:param username: The user name for login
|
||||
:type username: str
|
||||
@ -86,9 +91,10 @@ def login_user(username, password):
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def logout_user():
|
||||
"""
|
||||
Logs out current logged in user session
|
||||
def logout_user(): # noqa: E501
|
||||
"""Logs out current logged in user session
|
||||
|
||||
# noqa: E501
|
||||
|
||||
|
||||
:rtype: None
|
||||
@ -96,10 +102,11 @@ def logout_user():
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def update_user(username, body):
|
||||
"""
|
||||
Updated user
|
||||
This can only be done by the logged in user.
|
||||
def update_user(username, body): # noqa: E501
|
||||
"""Updated user
|
||||
|
||||
This can only be done by the logged in user. # noqa: E501
|
||||
|
||||
:param username: name that need to be deleted
|
||||
:type username: str
|
||||
:param body: Updated user object
|
||||
@ -108,5 +115,5 @@ def update_user(username, body):
|
||||
:rtype: None
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
body = User.from_dict(connexion.request.get_json())
|
||||
body = User.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
return 'do some magic!'
|
||||
|
@ -1,6 +1,8 @@
|
||||
from six import iteritems
|
||||
from swagger_server.models.base_model_ import Model
|
||||
from connexion.apps.flask_app import FlaskJSONEncoder
|
||||
import six
|
||||
|
||||
from swagger_server.models.base_model_ import Model
|
||||
|
||||
|
||||
class JSONEncoder(FlaskJSONEncoder):
|
||||
include_nulls = False
|
||||
@ -8,7 +10,7 @@ class JSONEncoder(FlaskJSONEncoder):
|
||||
def default(self, o):
|
||||
if isinstance(o, Model):
|
||||
dikt = {}
|
||||
for attr, _ in iteritems(o.swagger_types):
|
||||
for attr, _ in six.iteritems(o.swagger_types):
|
||||
value = getattr(o, attr)
|
||||
if value is None and not self.include_nulls:
|
||||
continue
|
||||
|
@ -1,10 +1,11 @@
|
||||
# coding: utf-8
|
||||
|
||||
# flake8: noqa
|
||||
from __future__ import absolute_import
|
||||
# import models into model package
|
||||
from .api_response import ApiResponse
|
||||
from .category import Category
|
||||
from .order import Order
|
||||
from .pet import Pet
|
||||
from .tag import Tag
|
||||
from .user import User
|
||||
from swagger_server.models.api_response import ApiResponse
|
||||
from swagger_server.models.category import Category
|
||||
from swagger_server.models.order import Order
|
||||
from swagger_server.models.pet import Pet
|
||||
from swagger_server.models.tag import Tag
|
||||
from swagger_server.models.user import User
|
||||
|
@ -1,28 +1,28 @@
|
||||
# coding: utf-8
|
||||
|
||||
from __future__ import absolute_import
|
||||
from .base_model_ import Model
|
||||
from datetime import date, datetime
|
||||
from typing import List, Dict
|
||||
from ..util import deserialize_model
|
||||
from datetime import date, datetime # noqa: F401
|
||||
|
||||
from typing import List, Dict # noqa: F401
|
||||
|
||||
from swagger_server.models.base_model_ import Model
|
||||
from swagger_server import util
|
||||
|
||||
|
||||
class ApiResponse(Model):
|
||||
"""
|
||||
NOTE: This class is auto generated by the swagger code generator program.
|
||||
"""NOTE: This class is auto generated by the swagger code generator program.
|
||||
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
def __init__(self, code=None, type=None, message=None): # noqa: E501
|
||||
"""ApiResponse - a model defined in Swagger
|
||||
|
||||
def __init__(self, code=None, type=None, message=None):
|
||||
"""
|
||||
ApiResponse - a model defined in Swagger
|
||||
|
||||
:param code: The code of this ApiResponse.
|
||||
:param code: The code of this ApiResponse. # noqa: E501
|
||||
:type code: int
|
||||
:param type: The type of this ApiResponse.
|
||||
:param type: The type of this ApiResponse. # noqa: E501
|
||||
:type type: str
|
||||
:param message: The message of this ApiResponse.
|
||||
:param message: The message of this ApiResponse. # noqa: E501
|
||||
:type message: str
|
||||
"""
|
||||
self.swagger_types = {
|
||||
@ -43,20 +43,19 @@ class ApiResponse(Model):
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, dikt):
|
||||
"""
|
||||
Returns the dict as a model
|
||||
"""Returns the dict as a model
|
||||
|
||||
:param dikt: A dict.
|
||||
:type: dict
|
||||
:return: The ApiResponse of this ApiResponse.
|
||||
:return: The ApiResponse of this ApiResponse. # noqa: E501
|
||||
:rtype: ApiResponse
|
||||
"""
|
||||
return deserialize_model(dikt, cls)
|
||||
return util.deserialize_model(dikt, cls)
|
||||
|
||||
@property
|
||||
def code(self):
|
||||
"""
|
||||
Gets the code of this ApiResponse.
|
||||
"""Gets the code of this ApiResponse.
|
||||
|
||||
|
||||
:return: The code of this ApiResponse.
|
||||
:rtype: int
|
||||
@ -65,8 +64,8 @@ class ApiResponse(Model):
|
||||
|
||||
@code.setter
|
||||
def code(self, code):
|
||||
"""
|
||||
Sets the code of this ApiResponse.
|
||||
"""Sets the code of this ApiResponse.
|
||||
|
||||
|
||||
:param code: The code of this ApiResponse.
|
||||
:type code: int
|
||||
@ -76,8 +75,8 @@ class ApiResponse(Model):
|
||||
|
||||
@property
|
||||
def type(self):
|
||||
"""
|
||||
Gets the type of this ApiResponse.
|
||||
"""Gets the type of this ApiResponse.
|
||||
|
||||
|
||||
:return: The type of this ApiResponse.
|
||||
:rtype: str
|
||||
@ -86,8 +85,8 @@ class ApiResponse(Model):
|
||||
|
||||
@type.setter
|
||||
def type(self, type):
|
||||
"""
|
||||
Sets the type of this ApiResponse.
|
||||
"""Sets the type of this ApiResponse.
|
||||
|
||||
|
||||
:param type: The type of this ApiResponse.
|
||||
:type type: str
|
||||
@ -97,8 +96,8 @@ class ApiResponse(Model):
|
||||
|
||||
@property
|
||||
def message(self):
|
||||
"""
|
||||
Gets the message of this ApiResponse.
|
||||
"""Gets the message of this ApiResponse.
|
||||
|
||||
|
||||
:return: The message of this ApiResponse.
|
||||
:rtype: str
|
||||
@ -107,12 +106,11 @@ class ApiResponse(Model):
|
||||
|
||||
@message.setter
|
||||
def message(self, message):
|
||||
"""
|
||||
Sets the message of this ApiResponse.
|
||||
"""Sets the message of this ApiResponse.
|
||||
|
||||
|
||||
:param message: The message of this ApiResponse.
|
||||
:type message: str
|
||||
"""
|
||||
|
||||
self._message = message
|
||||
|
||||
|
@ -1,31 +1,32 @@
|
||||
from pprint import pformat
|
||||
from six import iteritems
|
||||
from ..util import deserialize_model
|
||||
import pprint
|
||||
|
||||
import six
|
||||
|
||||
from swagger_server import util
|
||||
|
||||
|
||||
class Model(object):
|
||||
# swaggerTypes: The key is attribute name and the value is attribute type.
|
||||
# swaggerTypes: The key is attribute name and the
|
||||
# value is attribute type.
|
||||
swagger_types = {}
|
||||
|
||||
# attributeMap: The key is attribute name and the value is json key in definition.
|
||||
# attributeMap: The key is attribute name and the
|
||||
# value is json key in definition.
|
||||
attribute_map = {}
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, dikt):
|
||||
"""
|
||||
Returns the dict as a model
|
||||
"""
|
||||
return deserialize_model(dikt, cls)
|
||||
"""Returns the dict as a model"""
|
||||
return util.deserialize_model(dikt, cls)
|
||||
|
||||
def to_dict(self):
|
||||
"""
|
||||
Returns the model properties as a dict
|
||||
"""Returns the model properties as a dict
|
||||
|
||||
:rtype: dict
|
||||
"""
|
||||
result = {}
|
||||
|
||||
for attr, _ in iteritems(self.swagger_types):
|
||||
for attr, _ in six.iteritems(self.swagger_types):
|
||||
value = getattr(self, attr)
|
||||
if isinstance(value, list):
|
||||
result[attr] = list(map(
|
||||
@ -46,27 +47,20 @@ class Model(object):
|
||||
return result
|
||||
|
||||
def to_str(self):
|
||||
"""
|
||||
Returns the string representation of the model
|
||||
"""Returns the string representation of the model
|
||||
|
||||
:rtype: str
|
||||
"""
|
||||
return pformat(self.to_dict())
|
||||
return pprint.pformat(self.to_dict())
|
||||
|
||||
def __repr__(self):
|
||||
"""
|
||||
For `print` and `pprint`
|
||||
"""
|
||||
"""For `print` and `pprint`"""
|
||||
return self.to_str()
|
||||
|
||||
def __eq__(self, other):
|
||||
"""
|
||||
Returns true if both objects are equal
|
||||
"""
|
||||
"""Returns true if both objects are equal"""
|
||||
return self.__dict__ == other.__dict__
|
||||
|
||||
def __ne__(self, other):
|
||||
"""
|
||||
Returns true if both objects are not equal
|
||||
"""
|
||||
"""Returns true if both objects are not equal"""
|
||||
return not self == other
|
@ -1,26 +1,26 @@
|
||||
# coding: utf-8
|
||||
|
||||
from __future__ import absolute_import
|
||||
from .base_model_ import Model
|
||||
from datetime import date, datetime
|
||||
from typing import List, Dict
|
||||
from ..util import deserialize_model
|
||||
from datetime import date, datetime # noqa: F401
|
||||
|
||||
from typing import List, Dict # noqa: F401
|
||||
|
||||
from swagger_server.models.base_model_ import Model
|
||||
from swagger_server import util
|
||||
|
||||
|
||||
class Category(Model):
|
||||
"""
|
||||
NOTE: This class is auto generated by the swagger code generator program.
|
||||
"""NOTE: This class is auto generated by the swagger code generator program.
|
||||
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
def __init__(self, id=None, name=None): # noqa: E501
|
||||
"""Category - a model defined in Swagger
|
||||
|
||||
def __init__(self, id=None, name=None):
|
||||
"""
|
||||
Category - a model defined in Swagger
|
||||
|
||||
:param id: The id of this Category.
|
||||
:param id: The id of this Category. # noqa: E501
|
||||
:type id: long
|
||||
:param name: The name of this Category.
|
||||
:param name: The name of this Category. # noqa: E501
|
||||
:type name: str
|
||||
"""
|
||||
self.swagger_types = {
|
||||
@ -38,20 +38,19 @@ class Category(Model):
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, dikt):
|
||||
"""
|
||||
Returns the dict as a model
|
||||
"""Returns the dict as a model
|
||||
|
||||
:param dikt: A dict.
|
||||
:type: dict
|
||||
:return: The Category of this Category.
|
||||
:return: The Category of this Category. # noqa: E501
|
||||
:rtype: Category
|
||||
"""
|
||||
return deserialize_model(dikt, cls)
|
||||
return util.deserialize_model(dikt, cls)
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
"""
|
||||
Gets the id of this Category.
|
||||
"""Gets the id of this Category.
|
||||
|
||||
|
||||
:return: The id of this Category.
|
||||
:rtype: long
|
||||
@ -60,8 +59,8 @@ class Category(Model):
|
||||
|
||||
@id.setter
|
||||
def id(self, id):
|
||||
"""
|
||||
Sets the id of this Category.
|
||||
"""Sets the id of this Category.
|
||||
|
||||
|
||||
:param id: The id of this Category.
|
||||
:type id: long
|
||||
@ -71,8 +70,8 @@ class Category(Model):
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""
|
||||
Gets the name of this Category.
|
||||
"""Gets the name of this Category.
|
||||
|
||||
|
||||
:return: The name of this Category.
|
||||
:rtype: str
|
||||
@ -81,12 +80,11 @@ class Category(Model):
|
||||
|
||||
@name.setter
|
||||
def name(self, name):
|
||||
"""
|
||||
Sets the name of this Category.
|
||||
"""Sets the name of this Category.
|
||||
|
||||
|
||||
:param name: The name of this Category.
|
||||
:type name: str
|
||||
"""
|
||||
|
||||
self._name = name
|
||||
|
||||
|
@ -1,34 +1,34 @@
|
||||
# coding: utf-8
|
||||
|
||||
from __future__ import absolute_import
|
||||
from .base_model_ import Model
|
||||
from datetime import date, datetime
|
||||
from typing import List, Dict
|
||||
from ..util import deserialize_model
|
||||
from datetime import date, datetime # noqa: F401
|
||||
|
||||
from typing import List, Dict # noqa: F401
|
||||
|
||||
from swagger_server.models.base_model_ import Model
|
||||
from swagger_server import util
|
||||
|
||||
|
||||
class Order(Model):
|
||||
"""
|
||||
NOTE: This class is auto generated by the swagger code generator program.
|
||||
"""NOTE: This class is auto generated by the swagger code generator program.
|
||||
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
def __init__(self, id=None, pet_id=None, quantity=None, ship_date=None, status=None, complete=False): # noqa: E501
|
||||
"""Order - a model defined in Swagger
|
||||
|
||||
def __init__(self, id=None, pet_id=None, quantity=None, ship_date=None, status=None, complete=False):
|
||||
"""
|
||||
Order - a model defined in Swagger
|
||||
|
||||
:param id: The id of this Order.
|
||||
:param id: The id of this Order. # noqa: E501
|
||||
:type id: long
|
||||
:param pet_id: The pet_id of this Order.
|
||||
:param pet_id: The pet_id of this Order. # noqa: E501
|
||||
:type pet_id: long
|
||||
:param quantity: The quantity of this Order.
|
||||
:param quantity: The quantity of this Order. # noqa: E501
|
||||
:type quantity: int
|
||||
:param ship_date: The ship_date of this Order.
|
||||
:param ship_date: The ship_date of this Order. # noqa: E501
|
||||
:type ship_date: datetime
|
||||
:param status: The status of this Order.
|
||||
:param status: The status of this Order. # noqa: E501
|
||||
:type status: str
|
||||
:param complete: The complete of this Order.
|
||||
:param complete: The complete of this Order. # noqa: E501
|
||||
:type complete: bool
|
||||
"""
|
||||
self.swagger_types = {
|
||||
@ -58,20 +58,19 @@ class Order(Model):
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, dikt):
|
||||
"""
|
||||
Returns the dict as a model
|
||||
"""Returns the dict as a model
|
||||
|
||||
:param dikt: A dict.
|
||||
:type: dict
|
||||
:return: The Order of this Order.
|
||||
:return: The Order of this Order. # noqa: E501
|
||||
:rtype: Order
|
||||
"""
|
||||
return deserialize_model(dikt, cls)
|
||||
return util.deserialize_model(dikt, cls)
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
"""
|
||||
Gets the id of this Order.
|
||||
"""Gets the id of this Order.
|
||||
|
||||
|
||||
:return: The id of this Order.
|
||||
:rtype: long
|
||||
@ -80,8 +79,8 @@ class Order(Model):
|
||||
|
||||
@id.setter
|
||||
def id(self, id):
|
||||
"""
|
||||
Sets the id of this Order.
|
||||
"""Sets the id of this Order.
|
||||
|
||||
|
||||
:param id: The id of this Order.
|
||||
:type id: long
|
||||
@ -91,8 +90,8 @@ class Order(Model):
|
||||
|
||||
@property
|
||||
def pet_id(self):
|
||||
"""
|
||||
Gets the pet_id of this Order.
|
||||
"""Gets the pet_id of this Order.
|
||||
|
||||
|
||||
:return: The pet_id of this Order.
|
||||
:rtype: long
|
||||
@ -101,8 +100,8 @@ class Order(Model):
|
||||
|
||||
@pet_id.setter
|
||||
def pet_id(self, pet_id):
|
||||
"""
|
||||
Sets the pet_id of this Order.
|
||||
"""Sets the pet_id of this Order.
|
||||
|
||||
|
||||
:param pet_id: The pet_id of this Order.
|
||||
:type pet_id: long
|
||||
@ -112,8 +111,8 @@ class Order(Model):
|
||||
|
||||
@property
|
||||
def quantity(self):
|
||||
"""
|
||||
Gets the quantity of this Order.
|
||||
"""Gets the quantity of this Order.
|
||||
|
||||
|
||||
:return: The quantity of this Order.
|
||||
:rtype: int
|
||||
@ -122,8 +121,8 @@ class Order(Model):
|
||||
|
||||
@quantity.setter
|
||||
def quantity(self, quantity):
|
||||
"""
|
||||
Sets the quantity of this Order.
|
||||
"""Sets the quantity of this Order.
|
||||
|
||||
|
||||
:param quantity: The quantity of this Order.
|
||||
:type quantity: int
|
||||
@ -133,8 +132,8 @@ class Order(Model):
|
||||
|
||||
@property
|
||||
def ship_date(self):
|
||||
"""
|
||||
Gets the ship_date of this Order.
|
||||
"""Gets the ship_date of this Order.
|
||||
|
||||
|
||||
:return: The ship_date of this Order.
|
||||
:rtype: datetime
|
||||
@ -143,8 +142,8 @@ class Order(Model):
|
||||
|
||||
@ship_date.setter
|
||||
def ship_date(self, ship_date):
|
||||
"""
|
||||
Sets the ship_date of this Order.
|
||||
"""Sets the ship_date of this Order.
|
||||
|
||||
|
||||
:param ship_date: The ship_date of this Order.
|
||||
:type ship_date: datetime
|
||||
@ -154,9 +153,9 @@ class Order(Model):
|
||||
|
||||
@property
|
||||
def status(self):
|
||||
"""
|
||||
Gets the status of this Order.
|
||||
Order Status
|
||||
"""Gets the status of this Order.
|
||||
|
||||
Order Status # noqa: E501
|
||||
|
||||
:return: The status of this Order.
|
||||
:rtype: str
|
||||
@ -165,14 +164,14 @@ class Order(Model):
|
||||
|
||||
@status.setter
|
||||
def status(self, status):
|
||||
"""
|
||||
Sets the status of this Order.
|
||||
Order Status
|
||||
"""Sets the status of this Order.
|
||||
|
||||
Order Status # noqa: E501
|
||||
|
||||
:param status: The status of this Order.
|
||||
:type status: str
|
||||
"""
|
||||
allowed_values = ["placed", "approved", "delivered"]
|
||||
allowed_values = ["placed", "approved", "delivered"] # noqa: E501
|
||||
if status not in allowed_values:
|
||||
raise ValueError(
|
||||
"Invalid value for `status` ({0}), must be one of {1}"
|
||||
@ -183,8 +182,8 @@ class Order(Model):
|
||||
|
||||
@property
|
||||
def complete(self):
|
||||
"""
|
||||
Gets the complete of this Order.
|
||||
"""Gets the complete of this Order.
|
||||
|
||||
|
||||
:return: The complete of this Order.
|
||||
:rtype: bool
|
||||
@ -193,12 +192,11 @@ class Order(Model):
|
||||
|
||||
@complete.setter
|
||||
def complete(self, complete):
|
||||
"""
|
||||
Sets the complete of this Order.
|
||||
"""Sets the complete of this Order.
|
||||
|
||||
|
||||
:param complete: The complete of this Order.
|
||||
:type complete: bool
|
||||
"""
|
||||
|
||||
self._complete = complete
|
||||
|
||||
|
@ -1,36 +1,36 @@
|
||||
# coding: utf-8
|
||||
|
||||
from __future__ import absolute_import
|
||||
from swagger_server.models.category import Category
|
||||
from swagger_server.models.tag import Tag
|
||||
from .base_model_ import Model
|
||||
from datetime import date, datetime
|
||||
from typing import List, Dict
|
||||
from ..util import deserialize_model
|
||||
from datetime import date, datetime # noqa: F401
|
||||
|
||||
from typing import List, Dict # noqa: F401
|
||||
|
||||
from swagger_server.models.base_model_ import Model
|
||||
from swagger_server.models.category import Category # noqa: E501
|
||||
from swagger_server.models.tag import Tag # noqa: E501
|
||||
from swagger_server import util
|
||||
|
||||
|
||||
class Pet(Model):
|
||||
"""
|
||||
NOTE: This class is auto generated by the swagger code generator program.
|
||||
"""NOTE: This class is auto generated by the swagger code generator program.
|
||||
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
def __init__(self, id=None, category=None, name=None, photo_urls=None, tags=None, status=None): # noqa: E501
|
||||
"""Pet - a model defined in Swagger
|
||||
|
||||
def __init__(self, id=None, category=None, name=None, photo_urls=None, tags=None, status=None):
|
||||
"""
|
||||
Pet - a model defined in Swagger
|
||||
|
||||
:param id: The id of this Pet.
|
||||
:param id: The id of this Pet. # noqa: E501
|
||||
:type id: long
|
||||
:param category: The category of this Pet.
|
||||
:param category: The category of this Pet. # noqa: E501
|
||||
:type category: Category
|
||||
:param name: The name of this Pet.
|
||||
:param name: The name of this Pet. # noqa: E501
|
||||
:type name: str
|
||||
:param photo_urls: The photo_urls of this Pet.
|
||||
:param photo_urls: The photo_urls of this Pet. # noqa: E501
|
||||
:type photo_urls: List[str]
|
||||
:param tags: The tags of this Pet.
|
||||
:param tags: The tags of this Pet. # noqa: E501
|
||||
:type tags: List[Tag]
|
||||
:param status: The status of this Pet.
|
||||
:param status: The status of this Pet. # noqa: E501
|
||||
:type status: str
|
||||
"""
|
||||
self.swagger_types = {
|
||||
@ -60,20 +60,19 @@ class Pet(Model):
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, dikt):
|
||||
"""
|
||||
Returns the dict as a model
|
||||
"""Returns the dict as a model
|
||||
|
||||
:param dikt: A dict.
|
||||
:type: dict
|
||||
:return: The Pet of this Pet.
|
||||
:return: The Pet of this Pet. # noqa: E501
|
||||
:rtype: Pet
|
||||
"""
|
||||
return deserialize_model(dikt, cls)
|
||||
return util.deserialize_model(dikt, cls)
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
"""
|
||||
Gets the id of this Pet.
|
||||
"""Gets the id of this Pet.
|
||||
|
||||
|
||||
:return: The id of this Pet.
|
||||
:rtype: long
|
||||
@ -82,8 +81,8 @@ class Pet(Model):
|
||||
|
||||
@id.setter
|
||||
def id(self, id):
|
||||
"""
|
||||
Sets the id of this Pet.
|
||||
"""Sets the id of this Pet.
|
||||
|
||||
|
||||
:param id: The id of this Pet.
|
||||
:type id: long
|
||||
@ -93,8 +92,8 @@ class Pet(Model):
|
||||
|
||||
@property
|
||||
def category(self):
|
||||
"""
|
||||
Gets the category of this Pet.
|
||||
"""Gets the category of this Pet.
|
||||
|
||||
|
||||
:return: The category of this Pet.
|
||||
:rtype: Category
|
||||
@ -103,8 +102,8 @@ class Pet(Model):
|
||||
|
||||
@category.setter
|
||||
def category(self, category):
|
||||
"""
|
||||
Sets the category of this Pet.
|
||||
"""Sets the category of this Pet.
|
||||
|
||||
|
||||
:param category: The category of this Pet.
|
||||
:type category: Category
|
||||
@ -114,8 +113,8 @@ class Pet(Model):
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""
|
||||
Gets the name of this Pet.
|
||||
"""Gets the name of this Pet.
|
||||
|
||||
|
||||
:return: The name of this Pet.
|
||||
:rtype: str
|
||||
@ -124,21 +123,21 @@ class Pet(Model):
|
||||
|
||||
@name.setter
|
||||
def name(self, name):
|
||||
"""
|
||||
Sets the name of this Pet.
|
||||
"""Sets the name of this Pet.
|
||||
|
||||
|
||||
:param name: The name of this Pet.
|
||||
:type name: str
|
||||
"""
|
||||
if name is None:
|
||||
raise ValueError("Invalid value for `name`, must not be `None`")
|
||||
raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501
|
||||
|
||||
self._name = name
|
||||
|
||||
@property
|
||||
def photo_urls(self):
|
||||
"""
|
||||
Gets the photo_urls of this Pet.
|
||||
"""Gets the photo_urls of this Pet.
|
||||
|
||||
|
||||
:return: The photo_urls of this Pet.
|
||||
:rtype: List[str]
|
||||
@ -147,21 +146,21 @@ class Pet(Model):
|
||||
|
||||
@photo_urls.setter
|
||||
def photo_urls(self, photo_urls):
|
||||
"""
|
||||
Sets the photo_urls of this Pet.
|
||||
"""Sets the photo_urls of this Pet.
|
||||
|
||||
|
||||
:param photo_urls: The photo_urls of this Pet.
|
||||
:type photo_urls: List[str]
|
||||
"""
|
||||
if photo_urls is None:
|
||||
raise ValueError("Invalid value for `photo_urls`, must not be `None`")
|
||||
raise ValueError("Invalid value for `photo_urls`, must not be `None`") # noqa: E501
|
||||
|
||||
self._photo_urls = photo_urls
|
||||
|
||||
@property
|
||||
def tags(self):
|
||||
"""
|
||||
Gets the tags of this Pet.
|
||||
"""Gets the tags of this Pet.
|
||||
|
||||
|
||||
:return: The tags of this Pet.
|
||||
:rtype: List[Tag]
|
||||
@ -170,8 +169,8 @@ class Pet(Model):
|
||||
|
||||
@tags.setter
|
||||
def tags(self, tags):
|
||||
"""
|
||||
Sets the tags of this Pet.
|
||||
"""Sets the tags of this Pet.
|
||||
|
||||
|
||||
:param tags: The tags of this Pet.
|
||||
:type tags: List[Tag]
|
||||
@ -181,9 +180,9 @@ class Pet(Model):
|
||||
|
||||
@property
|
||||
def status(self):
|
||||
"""
|
||||
Gets the status of this Pet.
|
||||
pet status in the store
|
||||
"""Gets the status of this Pet.
|
||||
|
||||
pet status in the store # noqa: E501
|
||||
|
||||
:return: The status of this Pet.
|
||||
:rtype: str
|
||||
@ -192,14 +191,14 @@ class Pet(Model):
|
||||
|
||||
@status.setter
|
||||
def status(self, status):
|
||||
"""
|
||||
Sets the status of this Pet.
|
||||
pet status in the store
|
||||
"""Sets the status of this Pet.
|
||||
|
||||
pet status in the store # noqa: E501
|
||||
|
||||
:param status: The status of this Pet.
|
||||
:type status: str
|
||||
"""
|
||||
allowed_values = ["available", "pending", "sold"]
|
||||
allowed_values = ["available", "pending", "sold"] # noqa: E501
|
||||
if status not in allowed_values:
|
||||
raise ValueError(
|
||||
"Invalid value for `status` ({0}), must be one of {1}"
|
||||
@ -207,4 +206,3 @@ class Pet(Model):
|
||||
)
|
||||
|
||||
self._status = status
|
||||
|
||||
|
@ -1,26 +1,26 @@
|
||||
# coding: utf-8
|
||||
|
||||
from __future__ import absolute_import
|
||||
from .base_model_ import Model
|
||||
from datetime import date, datetime
|
||||
from typing import List, Dict
|
||||
from ..util import deserialize_model
|
||||
from datetime import date, datetime # noqa: F401
|
||||
|
||||
from typing import List, Dict # noqa: F401
|
||||
|
||||
from swagger_server.models.base_model_ import Model
|
||||
from swagger_server import util
|
||||
|
||||
|
||||
class Tag(Model):
|
||||
"""
|
||||
NOTE: This class is auto generated by the swagger code generator program.
|
||||
"""NOTE: This class is auto generated by the swagger code generator program.
|
||||
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
def __init__(self, id=None, name=None): # noqa: E501
|
||||
"""Tag - a model defined in Swagger
|
||||
|
||||
def __init__(self, id=None, name=None):
|
||||
"""
|
||||
Tag - a model defined in Swagger
|
||||
|
||||
:param id: The id of this Tag.
|
||||
:param id: The id of this Tag. # noqa: E501
|
||||
:type id: long
|
||||
:param name: The name of this Tag.
|
||||
:param name: The name of this Tag. # noqa: E501
|
||||
:type name: str
|
||||
"""
|
||||
self.swagger_types = {
|
||||
@ -38,20 +38,19 @@ class Tag(Model):
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, dikt):
|
||||
"""
|
||||
Returns the dict as a model
|
||||
"""Returns the dict as a model
|
||||
|
||||
:param dikt: A dict.
|
||||
:type: dict
|
||||
:return: The Tag of this Tag.
|
||||
:return: The Tag of this Tag. # noqa: E501
|
||||
:rtype: Tag
|
||||
"""
|
||||
return deserialize_model(dikt, cls)
|
||||
return util.deserialize_model(dikt, cls)
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
"""
|
||||
Gets the id of this Tag.
|
||||
"""Gets the id of this Tag.
|
||||
|
||||
|
||||
:return: The id of this Tag.
|
||||
:rtype: long
|
||||
@ -60,8 +59,8 @@ class Tag(Model):
|
||||
|
||||
@id.setter
|
||||
def id(self, id):
|
||||
"""
|
||||
Sets the id of this Tag.
|
||||
"""Sets the id of this Tag.
|
||||
|
||||
|
||||
:param id: The id of this Tag.
|
||||
:type id: long
|
||||
@ -71,8 +70,8 @@ class Tag(Model):
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""
|
||||
Gets the name of this Tag.
|
||||
"""Gets the name of this Tag.
|
||||
|
||||
|
||||
:return: The name of this Tag.
|
||||
:rtype: str
|
||||
@ -81,12 +80,11 @@ class Tag(Model):
|
||||
|
||||
@name.setter
|
||||
def name(self, name):
|
||||
"""
|
||||
Sets the name of this Tag.
|
||||
"""Sets the name of this Tag.
|
||||
|
||||
|
||||
:param name: The name of this Tag.
|
||||
:type name: str
|
||||
"""
|
||||
|
||||
self._name = name
|
||||
|
||||
|
@ -1,38 +1,38 @@
|
||||
# coding: utf-8
|
||||
|
||||
from __future__ import absolute_import
|
||||
from .base_model_ import Model
|
||||
from datetime import date, datetime
|
||||
from typing import List, Dict
|
||||
from ..util import deserialize_model
|
||||
from datetime import date, datetime # noqa: F401
|
||||
|
||||
from typing import List, Dict # noqa: F401
|
||||
|
||||
from swagger_server.models.base_model_ import Model
|
||||
from swagger_server import util
|
||||
|
||||
|
||||
class User(Model):
|
||||
"""
|
||||
NOTE: This class is auto generated by the swagger code generator program.
|
||||
"""NOTE: This class is auto generated by the swagger code generator program.
|
||||
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
def __init__(self, id=None, username=None, first_name=None, last_name=None, email=None, password=None, phone=None, user_status=None): # noqa: E501
|
||||
"""User - a model defined in Swagger
|
||||
|
||||
def __init__(self, id=None, username=None, first_name=None, last_name=None, email=None, password=None, phone=None, user_status=None):
|
||||
"""
|
||||
User - a model defined in Swagger
|
||||
|
||||
:param id: The id of this User.
|
||||
:param id: The id of this User. # noqa: E501
|
||||
:type id: long
|
||||
:param username: The username of this User.
|
||||
:param username: The username of this User. # noqa: E501
|
||||
:type username: str
|
||||
:param first_name: The first_name of this User.
|
||||
:param first_name: The first_name of this User. # noqa: E501
|
||||
:type first_name: str
|
||||
:param last_name: The last_name of this User.
|
||||
:param last_name: The last_name of this User. # noqa: E501
|
||||
:type last_name: str
|
||||
:param email: The email of this User.
|
||||
:param email: The email of this User. # noqa: E501
|
||||
:type email: str
|
||||
:param password: The password of this User.
|
||||
:param password: The password of this User. # noqa: E501
|
||||
:type password: str
|
||||
:param phone: The phone of this User.
|
||||
:param phone: The phone of this User. # noqa: E501
|
||||
:type phone: str
|
||||
:param user_status: The user_status of this User.
|
||||
:param user_status: The user_status of this User. # noqa: E501
|
||||
:type user_status: int
|
||||
"""
|
||||
self.swagger_types = {
|
||||
@ -68,20 +68,19 @@ class User(Model):
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, dikt):
|
||||
"""
|
||||
Returns the dict as a model
|
||||
"""Returns the dict as a model
|
||||
|
||||
:param dikt: A dict.
|
||||
:type: dict
|
||||
:return: The User of this User.
|
||||
:return: The User of this User. # noqa: E501
|
||||
:rtype: User
|
||||
"""
|
||||
return deserialize_model(dikt, cls)
|
||||
return util.deserialize_model(dikt, cls)
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
"""
|
||||
Gets the id of this User.
|
||||
"""Gets the id of this User.
|
||||
|
||||
|
||||
:return: The id of this User.
|
||||
:rtype: long
|
||||
@ -90,8 +89,8 @@ class User(Model):
|
||||
|
||||
@id.setter
|
||||
def id(self, id):
|
||||
"""
|
||||
Sets the id of this User.
|
||||
"""Sets the id of this User.
|
||||
|
||||
|
||||
:param id: The id of this User.
|
||||
:type id: long
|
||||
@ -101,8 +100,8 @@ class User(Model):
|
||||
|
||||
@property
|
||||
def username(self):
|
||||
"""
|
||||
Gets the username of this User.
|
||||
"""Gets the username of this User.
|
||||
|
||||
|
||||
:return: The username of this User.
|
||||
:rtype: str
|
||||
@ -111,8 +110,8 @@ class User(Model):
|
||||
|
||||
@username.setter
|
||||
def username(self, username):
|
||||
"""
|
||||
Sets the username of this User.
|
||||
"""Sets the username of this User.
|
||||
|
||||
|
||||
:param username: The username of this User.
|
||||
:type username: str
|
||||
@ -122,8 +121,8 @@ class User(Model):
|
||||
|
||||
@property
|
||||
def first_name(self):
|
||||
"""
|
||||
Gets the first_name of this User.
|
||||
"""Gets the first_name of this User.
|
||||
|
||||
|
||||
:return: The first_name of this User.
|
||||
:rtype: str
|
||||
@ -132,8 +131,8 @@ class User(Model):
|
||||
|
||||
@first_name.setter
|
||||
def first_name(self, first_name):
|
||||
"""
|
||||
Sets the first_name of this User.
|
||||
"""Sets the first_name of this User.
|
||||
|
||||
|
||||
:param first_name: The first_name of this User.
|
||||
:type first_name: str
|
||||
@ -143,8 +142,8 @@ class User(Model):
|
||||
|
||||
@property
|
||||
def last_name(self):
|
||||
"""
|
||||
Gets the last_name of this User.
|
||||
"""Gets the last_name of this User.
|
||||
|
||||
|
||||
:return: The last_name of this User.
|
||||
:rtype: str
|
||||
@ -153,8 +152,8 @@ class User(Model):
|
||||
|
||||
@last_name.setter
|
||||
def last_name(self, last_name):
|
||||
"""
|
||||
Sets the last_name of this User.
|
||||
"""Sets the last_name of this User.
|
||||
|
||||
|
||||
:param last_name: The last_name of this User.
|
||||
:type last_name: str
|
||||
@ -164,8 +163,8 @@ class User(Model):
|
||||
|
||||
@property
|
||||
def email(self):
|
||||
"""
|
||||
Gets the email of this User.
|
||||
"""Gets the email of this User.
|
||||
|
||||
|
||||
:return: The email of this User.
|
||||
:rtype: str
|
||||
@ -174,8 +173,8 @@ class User(Model):
|
||||
|
||||
@email.setter
|
||||
def email(self, email):
|
||||
"""
|
||||
Sets the email of this User.
|
||||
"""Sets the email of this User.
|
||||
|
||||
|
||||
:param email: The email of this User.
|
||||
:type email: str
|
||||
@ -185,8 +184,8 @@ class User(Model):
|
||||
|
||||
@property
|
||||
def password(self):
|
||||
"""
|
||||
Gets the password of this User.
|
||||
"""Gets the password of this User.
|
||||
|
||||
|
||||
:return: The password of this User.
|
||||
:rtype: str
|
||||
@ -195,8 +194,8 @@ class User(Model):
|
||||
|
||||
@password.setter
|
||||
def password(self, password):
|
||||
"""
|
||||
Sets the password of this User.
|
||||
"""Sets the password of this User.
|
||||
|
||||
|
||||
:param password: The password of this User.
|
||||
:type password: str
|
||||
@ -206,8 +205,8 @@ class User(Model):
|
||||
|
||||
@property
|
||||
def phone(self):
|
||||
"""
|
||||
Gets the phone of this User.
|
||||
"""Gets the phone of this User.
|
||||
|
||||
|
||||
:return: The phone of this User.
|
||||
:rtype: str
|
||||
@ -216,8 +215,8 @@ class User(Model):
|
||||
|
||||
@phone.setter
|
||||
def phone(self, phone):
|
||||
"""
|
||||
Sets the phone of this User.
|
||||
"""Sets the phone of this User.
|
||||
|
||||
|
||||
:param phone: The phone of this User.
|
||||
:type phone: str
|
||||
@ -227,9 +226,9 @@ class User(Model):
|
||||
|
||||
@property
|
||||
def user_status(self):
|
||||
"""
|
||||
Gets the user_status of this User.
|
||||
User Status
|
||||
"""Gets the user_status of this User.
|
||||
|
||||
User Status # noqa: E501
|
||||
|
||||
:return: The user_status of this User.
|
||||
:rtype: int
|
||||
@ -238,13 +237,12 @@ class User(Model):
|
||||
|
||||
@user_status.setter
|
||||
def user_status(self, user_status):
|
||||
"""
|
||||
Sets the user_status of this User.
|
||||
User Status
|
||||
"""Sets the user_status of this User.
|
||||
|
||||
User Status # noqa: E501
|
||||
|
||||
:param user_status: The user_status of this User.
|
||||
:type user_status: int
|
||||
"""
|
||||
|
||||
self._user_status = user_status
|
||||
|
||||
|
@ -108,11 +108,11 @@ paths:
|
||||
type: "array"
|
||||
items:
|
||||
type: "string"
|
||||
default: "available"
|
||||
enum:
|
||||
- "available"
|
||||
- "pending"
|
||||
- "sold"
|
||||
default: "available"
|
||||
collectionFormat: "csv"
|
||||
responses:
|
||||
200:
|
||||
|
@ -1,8 +1,10 @@
|
||||
from flask_testing import TestCase
|
||||
from ..encoder import JSONEncoder
|
||||
import connexion
|
||||
import logging
|
||||
|
||||
import connexion
|
||||
from flask_testing import TestCase
|
||||
|
||||
from swagger_server.encoder import JSONEncoder
|
||||
|
||||
|
||||
class BaseTestCase(TestCase):
|
||||
|
||||
|
@ -2,115 +2,124 @@
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
from swagger_server.models.api_response import ApiResponse
|
||||
from swagger_server.models.pet import Pet
|
||||
from . import BaseTestCase
|
||||
from six import BytesIO
|
||||
from flask import json
|
||||
from six import BytesIO
|
||||
|
||||
from swagger_server.models.api_response import ApiResponse # noqa: E501
|
||||
from swagger_server.models.pet import Pet # noqa: E501
|
||||
from swagger_server.test import BaseTestCase
|
||||
|
||||
|
||||
class TestPetController(BaseTestCase):
|
||||
"""PetController integration test stubs"""
|
||||
|
||||
def test_add_pet(self):
|
||||
"""
|
||||
Test case for add_pet
|
||||
"""Test case for add_pet
|
||||
|
||||
Add a new pet to the store
|
||||
"""
|
||||
body = Pet()
|
||||
response = self.client.open('/v2/pet',
|
||||
response = self.client.open(
|
||||
'/v2/pet',
|
||||
method='POST',
|
||||
data=json.dumps(body),
|
||||
content_type='application/json')
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_delete_pet(self):
|
||||
"""
|
||||
Test case for delete_pet
|
||||
"""Test case for delete_pet
|
||||
|
||||
Deletes a pet
|
||||
"""
|
||||
headers = [('api_key', 'api_key_example')]
|
||||
response = self.client.open('/v2/pet/{petId}'.format(petId=789),
|
||||
response = self.client.open(
|
||||
'/v2/pet/{petId}'.format(petId=789),
|
||||
method='DELETE',
|
||||
headers=headers)
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_find_pets_by_status(self):
|
||||
"""
|
||||
Test case for find_pets_by_status
|
||||
"""Test case for find_pets_by_status
|
||||
|
||||
Finds Pets by status
|
||||
"""
|
||||
query_string = [('status', 'available')]
|
||||
response = self.client.open('/v2/pet/findByStatus',
|
||||
response = self.client.open(
|
||||
'/v2/pet/findByStatus',
|
||||
method='GET',
|
||||
query_string=query_string)
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_find_pets_by_tags(self):
|
||||
"""
|
||||
Test case for find_pets_by_tags
|
||||
"""Test case for find_pets_by_tags
|
||||
|
||||
Finds Pets by tags
|
||||
"""
|
||||
query_string = [('tags', 'tags_example')]
|
||||
response = self.client.open('/v2/pet/findByTags',
|
||||
response = self.client.open(
|
||||
'/v2/pet/findByTags',
|
||||
method='GET',
|
||||
query_string=query_string)
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_get_pet_by_id(self):
|
||||
"""
|
||||
Test case for get_pet_by_id
|
||||
"""Test case for get_pet_by_id
|
||||
|
||||
Find pet by ID
|
||||
"""
|
||||
response = self.client.open('/v2/pet/{petId}'.format(petId=789),
|
||||
response = self.client.open(
|
||||
'/v2/pet/{petId}'.format(petId=789),
|
||||
method='GET')
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_update_pet(self):
|
||||
"""
|
||||
Test case for update_pet
|
||||
"""Test case for update_pet
|
||||
|
||||
Update an existing pet
|
||||
"""
|
||||
body = Pet()
|
||||
response = self.client.open('/v2/pet',
|
||||
response = self.client.open(
|
||||
'/v2/pet',
|
||||
method='PUT',
|
||||
data=json.dumps(body),
|
||||
content_type='application/json')
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_update_pet_with_form(self):
|
||||
"""
|
||||
Test case for update_pet_with_form
|
||||
"""Test case for update_pet_with_form
|
||||
|
||||
Updates a pet in the store with form data
|
||||
"""
|
||||
data = dict(name='name_example',
|
||||
status='status_example')
|
||||
response = self.client.open('/v2/pet/{petId}'.format(petId=789),
|
||||
response = self.client.open(
|
||||
'/v2/pet/{petId}'.format(petId=789),
|
||||
method='POST',
|
||||
data=data,
|
||||
content_type='application/x-www-form-urlencoded')
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_upload_file(self):
|
||||
"""
|
||||
Test case for upload_file
|
||||
"""Test case for upload_file
|
||||
|
||||
uploads an image
|
||||
"""
|
||||
data = dict(additionalMetadata='additionalMetadata_example',
|
||||
file=(BytesIO(b'some file data'), 'file.txt'))
|
||||
response = self.client.open('/v2/pet/{petId}/uploadImage'.format(petId=789),
|
||||
response = self.client.open(
|
||||
'/v2/pet/{petId}/uploadImage'.format(petId=789),
|
||||
method='POST',
|
||||
data=data,
|
||||
content_type='multipart/form-data')
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -2,57 +2,62 @@
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
from swagger_server.models.order import Order
|
||||
from . import BaseTestCase
|
||||
from six import BytesIO
|
||||
from flask import json
|
||||
from six import BytesIO
|
||||
|
||||
from swagger_server.models.order import Order # noqa: E501
|
||||
from swagger_server.test import BaseTestCase
|
||||
|
||||
|
||||
class TestStoreController(BaseTestCase):
|
||||
"""StoreController integration test stubs"""
|
||||
|
||||
def test_delete_order(self):
|
||||
"""
|
||||
Test case for delete_order
|
||||
"""Test case for delete_order
|
||||
|
||||
Delete purchase order by ID
|
||||
"""
|
||||
response = self.client.open('/v2/store/order/{orderId}'.format(orderId='orderId_example'),
|
||||
response = self.client.open(
|
||||
'/v2/store/order/{orderId}'.format(orderId='orderId_example'),
|
||||
method='DELETE')
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_get_inventory(self):
|
||||
"""
|
||||
Test case for get_inventory
|
||||
"""Test case for get_inventory
|
||||
|
||||
Returns pet inventories by status
|
||||
"""
|
||||
response = self.client.open('/v2/store/inventory',
|
||||
response = self.client.open(
|
||||
'/v2/store/inventory',
|
||||
method='GET')
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_get_order_by_id(self):
|
||||
"""
|
||||
Test case for get_order_by_id
|
||||
"""Test case for get_order_by_id
|
||||
|
||||
Find purchase order by ID
|
||||
"""
|
||||
response = self.client.open('/v2/store/order/{orderId}'.format(orderId=5),
|
||||
response = self.client.open(
|
||||
'/v2/store/order/{orderId}'.format(orderId=5),
|
||||
method='GET')
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_place_order(self):
|
||||
"""
|
||||
Test case for place_order
|
||||
"""Test case for place_order
|
||||
|
||||
Place an order for a pet
|
||||
"""
|
||||
body = Order()
|
||||
response = self.client.open('/v2/store/order',
|
||||
response = self.client.open(
|
||||
'/v2/store/order',
|
||||
method='POST',
|
||||
data=json.dumps(body),
|
||||
content_type='application/json')
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -2,109 +2,118 @@
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
from swagger_server.models.user import User
|
||||
from . import BaseTestCase
|
||||
from six import BytesIO
|
||||
from flask import json
|
||||
from six import BytesIO
|
||||
|
||||
from swagger_server.models.user import User # noqa: E501
|
||||
from swagger_server.test import BaseTestCase
|
||||
|
||||
|
||||
class TestUserController(BaseTestCase):
|
||||
"""UserController integration test stubs"""
|
||||
|
||||
def test_create_user(self):
|
||||
"""
|
||||
Test case for create_user
|
||||
"""Test case for create_user
|
||||
|
||||
Create user
|
||||
"""
|
||||
body = User()
|
||||
response = self.client.open('/v2/user',
|
||||
response = self.client.open(
|
||||
'/v2/user',
|
||||
method='POST',
|
||||
data=json.dumps(body),
|
||||
content_type='application/json')
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_create_users_with_array_input(self):
|
||||
"""
|
||||
Test case for create_users_with_array_input
|
||||
"""Test case for create_users_with_array_input
|
||||
|
||||
Creates list of users with given input array
|
||||
"""
|
||||
body = [User()]
|
||||
response = self.client.open('/v2/user/createWithArray',
|
||||
response = self.client.open(
|
||||
'/v2/user/createWithArray',
|
||||
method='POST',
|
||||
data=json.dumps(body),
|
||||
content_type='application/json')
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_create_users_with_list_input(self):
|
||||
"""
|
||||
Test case for create_users_with_list_input
|
||||
"""Test case for create_users_with_list_input
|
||||
|
||||
Creates list of users with given input array
|
||||
"""
|
||||
body = [User()]
|
||||
response = self.client.open('/v2/user/createWithList',
|
||||
response = self.client.open(
|
||||
'/v2/user/createWithList',
|
||||
method='POST',
|
||||
data=json.dumps(body),
|
||||
content_type='application/json')
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_delete_user(self):
|
||||
"""
|
||||
Test case for delete_user
|
||||
"""Test case for delete_user
|
||||
|
||||
Delete user
|
||||
"""
|
||||
response = self.client.open('/v2/user/{username}'.format(username='username_example'),
|
||||
response = self.client.open(
|
||||
'/v2/user/{username}'.format(username='username_example'),
|
||||
method='DELETE')
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_get_user_by_name(self):
|
||||
"""
|
||||
Test case for get_user_by_name
|
||||
"""Test case for get_user_by_name
|
||||
|
||||
Get user by user name
|
||||
"""
|
||||
response = self.client.open('/v2/user/{username}'.format(username='username_example'),
|
||||
response = self.client.open(
|
||||
'/v2/user/{username}'.format(username='username_example'),
|
||||
method='GET')
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_login_user(self):
|
||||
"""
|
||||
Test case for login_user
|
||||
"""Test case for login_user
|
||||
|
||||
Logs user into the system
|
||||
"""
|
||||
query_string = [('username', 'username_example'),
|
||||
('password', 'password_example')]
|
||||
response = self.client.open('/v2/user/login',
|
||||
response = self.client.open(
|
||||
'/v2/user/login',
|
||||
method='GET',
|
||||
query_string=query_string)
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_logout_user(self):
|
||||
"""
|
||||
Test case for logout_user
|
||||
"""Test case for logout_user
|
||||
|
||||
Logs out current logged in user session
|
||||
"""
|
||||
response = self.client.open('/v2/user/logout',
|
||||
response = self.client.open(
|
||||
'/v2/user/logout',
|
||||
method='GET')
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_update_user(self):
|
||||
"""
|
||||
Test case for update_user
|
||||
"""Test case for update_user
|
||||
|
||||
Updated user
|
||||
"""
|
||||
body = User()
|
||||
response = self.client.open('/v2/user/{username}'.format(username='username_example'),
|
||||
response = self.client.open(
|
||||
'/v2/user/{username}'.format(username='username_example'),
|
||||
method='PUT',
|
||||
data=json.dumps(body),
|
||||
content_type='application/json')
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -1,11 +1,11 @@
|
||||
from typing import GenericMeta
|
||||
from datetime import datetime, date
|
||||
from six import integer_types, iteritems
|
||||
import datetime
|
||||
|
||||
import six
|
||||
import typing
|
||||
|
||||
|
||||
def _deserialize(data, klass):
|
||||
"""
|
||||
Deserializes dict, list, str into an object.
|
||||
"""Deserializes dict, list, str into an object.
|
||||
|
||||
:param data: dict, list or str.
|
||||
:param klass: class literal, or string of class name.
|
||||
@ -15,15 +15,15 @@ def _deserialize(data, klass):
|
||||
if data is None:
|
||||
return None
|
||||
|
||||
if klass in integer_types or klass in (float, str, bool):
|
||||
if klass in six.integer_types or klass in (float, str, bool):
|
||||
return _deserialize_primitive(data, klass)
|
||||
elif klass == object:
|
||||
return _deserialize_object(data)
|
||||
elif klass == date:
|
||||
elif klass == datetime.date:
|
||||
return deserialize_date(data)
|
||||
elif klass == datetime:
|
||||
elif klass == datetime.datetime:
|
||||
return deserialize_datetime(data)
|
||||
elif type(klass) == GenericMeta:
|
||||
elif type(klass) == typing.GenericMeta:
|
||||
if klass.__extra__ == list:
|
||||
return _deserialize_list(data, klass.__args__[0])
|
||||
if klass.__extra__ == dict:
|
||||
@ -33,8 +33,7 @@ def _deserialize(data, klass):
|
||||
|
||||
|
||||
def _deserialize_primitive(data, klass):
|
||||
"""
|
||||
Deserializes to primitive type.
|
||||
"""Deserializes to primitive type.
|
||||
|
||||
:param data: data to deserialize.
|
||||
:param klass: class literal.
|
||||
@ -52,8 +51,7 @@ def _deserialize_primitive(data, klass):
|
||||
|
||||
|
||||
def _deserialize_object(value):
|
||||
"""
|
||||
Return a original value.
|
||||
"""Return a original value.
|
||||
|
||||
:return: object.
|
||||
"""
|
||||
@ -61,8 +59,7 @@ def _deserialize_object(value):
|
||||
|
||||
|
||||
def deserialize_date(string):
|
||||
"""
|
||||
Deserializes string to date.
|
||||
"""Deserializes string to date.
|
||||
|
||||
:param string: str.
|
||||
:type string: str
|
||||
@ -77,8 +74,7 @@ def deserialize_date(string):
|
||||
|
||||
|
||||
def deserialize_datetime(string):
|
||||
"""
|
||||
Deserializes string to datetime.
|
||||
"""Deserializes string to datetime.
|
||||
|
||||
The string should be in iso8601 datetime format.
|
||||
|
||||
@ -95,8 +91,7 @@ def deserialize_datetime(string):
|
||||
|
||||
|
||||
def deserialize_model(data, klass):
|
||||
"""
|
||||
Deserializes list or dict to model.
|
||||
"""Deserializes list or dict to model.
|
||||
|
||||
:param data: dict, list.
|
||||
:type data: dict | list
|
||||
@ -108,7 +103,7 @@ def deserialize_model(data, klass):
|
||||
if not instance.swagger_types:
|
||||
return data
|
||||
|
||||
for attr, attr_type in iteritems(instance.swagger_types):
|
||||
for attr, attr_type in six.iteritems(instance.swagger_types):
|
||||
if data is not None \
|
||||
and instance.attribute_map[attr] in data \
|
||||
and isinstance(data, (list, dict)):
|
||||
@ -119,8 +114,7 @@ def deserialize_model(data, klass):
|
||||
|
||||
|
||||
def _deserialize_list(data, boxed_type):
|
||||
"""
|
||||
Deserializes a list and its elements.
|
||||
"""Deserializes a list and its elements.
|
||||
|
||||
:param data: list to deserialize.
|
||||
:type data: list
|
||||
@ -133,10 +127,8 @@ def _deserialize_list(data, boxed_type):
|
||||
for sub_data in data]
|
||||
|
||||
|
||||
|
||||
def _deserialize_dict(data, boxed_type):
|
||||
"""
|
||||
Deserializes a dict and its elements.
|
||||
"""Deserializes a dict and its elements.
|
||||
|
||||
:param data: dict to deserialize.
|
||||
:type data: dict
|
||||
@ -146,4 +138,4 @@ def _deserialize_dict(data, boxed_type):
|
||||
:rtype: dict
|
||||
"""
|
||||
return {k: _deserialize(v, boxed_type)
|
||||
for k, v in iteritems(data)}
|
||||
for k, v in six.iteritems(data)}
|
||||
|
@ -1,13 +1,14 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import connexion
|
||||
from .encoder import JSONEncoder
|
||||
|
||||
from swagger_server import encoder
|
||||
|
||||
|
||||
def main():
|
||||
app = connexion.App(__name__, specification_dir='./swagger/')
|
||||
app.app.json_encoder = JSONEncoder
|
||||
app.add_api('swagger.yaml', arguments={'title': 'This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.'})
|
||||
app.app.json_encoder = encoder.JSONEncoder
|
||||
app.add_api('swagger.yaml', arguments={'title': 'Swagger Petstore'})
|
||||
app.run(port=8080)
|
||||
|
||||
|
||||
|
@ -1,15 +1,15 @@
|
||||
import connexion
|
||||
from swagger_server.models.api_response import ApiResponse
|
||||
from swagger_server.models.pet import Pet
|
||||
from datetime import date, datetime
|
||||
from typing import List, Dict
|
||||
from six import iteritems
|
||||
from ..util import deserialize_date, deserialize_datetime
|
||||
import six
|
||||
|
||||
from swagger_server.models.api_response import ApiResponse # noqa: E501
|
||||
from swagger_server.models.pet import Pet # noqa: E501
|
||||
from swagger_server import util
|
||||
|
||||
|
||||
def add_pet(body):
|
||||
"""
|
||||
Add a new pet to the store
|
||||
def add_pet(body): # noqa: E501
|
||||
"""Add a new pet to the store
|
||||
|
||||
# noqa: E501
|
||||
|
||||
:param body: Pet object that needs to be added to the store
|
||||
:type body: dict | bytes
|
||||
@ -17,13 +17,14 @@ def add_pet(body):
|
||||
:rtype: None
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
body = Pet.from_dict(connexion.request.get_json())
|
||||
body = Pet.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def delete_pet(petId, api_key=None):
|
||||
"""
|
||||
Deletes a pet
|
||||
def delete_pet(petId, api_key=None): # noqa: E501
|
||||
"""Deletes a pet
|
||||
|
||||
# noqa: E501
|
||||
|
||||
:param petId: Pet id to delete
|
||||
:type petId: int
|
||||
@ -35,10 +36,11 @@ def delete_pet(petId, api_key=None):
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def find_pets_by_status(status):
|
||||
"""
|
||||
Finds Pets by status
|
||||
Multiple status values can be provided with comma separated strings
|
||||
def find_pets_by_status(status): # noqa: E501
|
||||
"""Finds Pets by status
|
||||
|
||||
Multiple status values can be provided with comma separated strings # noqa: E501
|
||||
|
||||
:param status: Status values that need to be considered for filter
|
||||
:type status: List[str]
|
||||
|
||||
@ -47,10 +49,11 @@ def find_pets_by_status(status):
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def find_pets_by_tags(tags):
|
||||
"""
|
||||
Finds Pets by tags
|
||||
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
def find_pets_by_tags(tags): # noqa: E501
|
||||
"""Finds Pets by tags
|
||||
|
||||
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. # noqa: E501
|
||||
|
||||
:param tags: Tags to filter by
|
||||
:type tags: List[str]
|
||||
|
||||
@ -59,10 +62,11 @@ def find_pets_by_tags(tags):
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def get_pet_by_id(petId):
|
||||
"""
|
||||
Find pet by ID
|
||||
Returns a single pet
|
||||
def get_pet_by_id(petId): # noqa: E501
|
||||
"""Find pet by ID
|
||||
|
||||
Returns a single pet # noqa: E501
|
||||
|
||||
:param petId: ID of pet to return
|
||||
:type petId: int
|
||||
|
||||
@ -71,9 +75,10 @@ def get_pet_by_id(petId):
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def update_pet(body):
|
||||
"""
|
||||
Update an existing pet
|
||||
def update_pet(body): # noqa: E501
|
||||
"""Update an existing pet
|
||||
|
||||
# noqa: E501
|
||||
|
||||
:param body: Pet object that needs to be added to the store
|
||||
:type body: dict | bytes
|
||||
@ -81,13 +86,14 @@ def update_pet(body):
|
||||
:rtype: None
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
body = Pet.from_dict(connexion.request.get_json())
|
||||
body = Pet.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def update_pet_with_form(petId, name=None, status=None):
|
||||
"""
|
||||
Updates a pet in the store with form data
|
||||
def update_pet_with_form(petId, name=None, status=None): # noqa: E501
|
||||
"""Updates a pet in the store with form data
|
||||
|
||||
# noqa: E501
|
||||
|
||||
:param petId: ID of pet that needs to be updated
|
||||
:type petId: int
|
||||
@ -101,9 +107,10 @@ def update_pet_with_form(petId, name=None, status=None):
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def upload_file(petId, additionalMetadata=None, file=None):
|
||||
"""
|
||||
uploads an image
|
||||
def upload_file(petId, additionalMetadata=None, file=None): # noqa: E501
|
||||
"""uploads an image
|
||||
|
||||
# noqa: E501
|
||||
|
||||
:param petId: ID of pet to update
|
||||
:type petId: int
|
||||
|
@ -1,15 +1,15 @@
|
||||
import connexion
|
||||
from swagger_server.models.order import Order
|
||||
from datetime import date, datetime
|
||||
from typing import List, Dict
|
||||
from six import iteritems
|
||||
from ..util import deserialize_date, deserialize_datetime
|
||||
import six
|
||||
|
||||
from swagger_server.models.order import Order # noqa: E501
|
||||
from swagger_server import util
|
||||
|
||||
|
||||
def delete_order(orderId):
|
||||
"""
|
||||
Delete purchase order by ID
|
||||
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
def delete_order(orderId): # noqa: E501
|
||||
"""Delete purchase order by ID
|
||||
|
||||
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors # noqa: E501
|
||||
|
||||
:param orderId: ID of the order that needs to be deleted
|
||||
:type orderId: str
|
||||
|
||||
@ -18,20 +18,22 @@ def delete_order(orderId):
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def get_inventory():
|
||||
"""
|
||||
Returns pet inventories by status
|
||||
Returns a map of status codes to quantities
|
||||
def get_inventory(): # noqa: E501
|
||||
"""Returns pet inventories by status
|
||||
|
||||
Returns a map of status codes to quantities # noqa: E501
|
||||
|
||||
|
||||
:rtype: Dict[str, int]
|
||||
"""
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def get_order_by_id(orderId):
|
||||
"""
|
||||
Find purchase order by ID
|
||||
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
def get_order_by_id(orderId): # noqa: E501
|
||||
"""Find purchase order by ID
|
||||
|
||||
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions # noqa: E501
|
||||
|
||||
:param orderId: ID of pet that needs to be fetched
|
||||
:type orderId: int
|
||||
|
||||
@ -40,9 +42,10 @@ def get_order_by_id(orderId):
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def place_order(body):
|
||||
"""
|
||||
Place an order for a pet
|
||||
def place_order(body): # noqa: E501
|
||||
"""Place an order for a pet
|
||||
|
||||
# noqa: E501
|
||||
|
||||
:param body: order placed for purchasing the pet
|
||||
:type body: dict | bytes
|
||||
@ -50,5 +53,5 @@ def place_order(body):
|
||||
:rtype: Order
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
body = Order.from_dict(connexion.request.get_json())
|
||||
body = Order.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
return 'do some magic!'
|
||||
|
@ -1,28 +1,29 @@
|
||||
import connexion
|
||||
from swagger_server.models.user import User
|
||||
from datetime import date, datetime
|
||||
from typing import List, Dict
|
||||
from six import iteritems
|
||||
from ..util import deserialize_date, deserialize_datetime
|
||||
import six
|
||||
|
||||
from swagger_server.models.user import User # noqa: E501
|
||||
from swagger_server import util
|
||||
|
||||
|
||||
def create_user(body):
|
||||
"""
|
||||
Create user
|
||||
This can only be done by the logged in user.
|
||||
def create_user(body): # noqa: E501
|
||||
"""Create user
|
||||
|
||||
This can only be done by the logged in user. # noqa: E501
|
||||
|
||||
:param body: Created user object
|
||||
:type body: dict | bytes
|
||||
|
||||
:rtype: None
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
body = User.from_dict(connexion.request.get_json())
|
||||
body = User.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def create_users_with_array_input(body):
|
||||
"""
|
||||
Creates list of users with given input array
|
||||
def create_users_with_array_input(body): # noqa: E501
|
||||
"""Creates list of users with given input array
|
||||
|
||||
# noqa: E501
|
||||
|
||||
:param body: List of user object
|
||||
:type body: list | bytes
|
||||
@ -30,13 +31,14 @@ def create_users_with_array_input(body):
|
||||
:rtype: None
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
body = [User.from_dict(d) for d in connexion.request.get_json()]
|
||||
body = [User.from_dict(d) for d in connexion.request.get_json()] # noqa: E501
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def create_users_with_list_input(body):
|
||||
"""
|
||||
Creates list of users with given input array
|
||||
def create_users_with_list_input(body): # noqa: E501
|
||||
"""Creates list of users with given input array
|
||||
|
||||
# noqa: E501
|
||||
|
||||
:param body: List of user object
|
||||
:type body: list | bytes
|
||||
@ -44,14 +46,15 @@ def create_users_with_list_input(body):
|
||||
:rtype: None
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
body = [User.from_dict(d) for d in connexion.request.get_json()]
|
||||
body = [User.from_dict(d) for d in connexion.request.get_json()] # noqa: E501
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def delete_user(username):
|
||||
"""
|
||||
Delete user
|
||||
This can only be done by the logged in user.
|
||||
def delete_user(username): # noqa: E501
|
||||
"""Delete user
|
||||
|
||||
This can only be done by the logged in user. # noqa: E501
|
||||
|
||||
:param username: The name that needs to be deleted
|
||||
:type username: str
|
||||
|
||||
@ -60,9 +63,10 @@ def delete_user(username):
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def get_user_by_name(username):
|
||||
"""
|
||||
Get user by user name
|
||||
def get_user_by_name(username): # noqa: E501
|
||||
"""Get user by user name
|
||||
|
||||
# noqa: E501
|
||||
|
||||
:param username: The name that needs to be fetched. Use user1 for testing.
|
||||
:type username: str
|
||||
@ -72,9 +76,10 @@ def get_user_by_name(username):
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def login_user(username, password):
|
||||
"""
|
||||
Logs user into the system
|
||||
def login_user(username, password): # noqa: E501
|
||||
"""Logs user into the system
|
||||
|
||||
# noqa: E501
|
||||
|
||||
:param username: The user name for login
|
||||
:type username: str
|
||||
@ -86,9 +91,10 @@ def login_user(username, password):
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def logout_user():
|
||||
"""
|
||||
Logs out current logged in user session
|
||||
def logout_user(): # noqa: E501
|
||||
"""Logs out current logged in user session
|
||||
|
||||
# noqa: E501
|
||||
|
||||
|
||||
:rtype: None
|
||||
@ -96,10 +102,11 @@ def logout_user():
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def update_user(username, body):
|
||||
"""
|
||||
Updated user
|
||||
This can only be done by the logged in user.
|
||||
def update_user(username, body): # noqa: E501
|
||||
"""Updated user
|
||||
|
||||
This can only be done by the logged in user. # noqa: E501
|
||||
|
||||
:param username: name that need to be deleted
|
||||
:type username: str
|
||||
:param body: Updated user object
|
||||
@ -108,5 +115,5 @@ def update_user(username, body):
|
||||
:rtype: None
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
body = User.from_dict(connexion.request.get_json())
|
||||
body = User.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
return 'do some magic!'
|
||||
|
@ -1,6 +1,8 @@
|
||||
from six import iteritems
|
||||
from swagger_server.models.base_model_ import Model
|
||||
from connexion.apps.flask_app import FlaskJSONEncoder
|
||||
import six
|
||||
|
||||
from swagger_server.models.base_model_ import Model
|
||||
|
||||
|
||||
class JSONEncoder(FlaskJSONEncoder):
|
||||
include_nulls = False
|
||||
@ -8,7 +10,7 @@ class JSONEncoder(FlaskJSONEncoder):
|
||||
def default(self, o):
|
||||
if isinstance(o, Model):
|
||||
dikt = {}
|
||||
for attr, _ in iteritems(o.swagger_types):
|
||||
for attr, _ in six.iteritems(o.swagger_types):
|
||||
value = getattr(o, attr)
|
||||
if value is None and not self.include_nulls:
|
||||
continue
|
||||
|
@ -1,10 +1,11 @@
|
||||
# coding: utf-8
|
||||
|
||||
# flake8: noqa
|
||||
from __future__ import absolute_import
|
||||
# import models into model package
|
||||
from .api_response import ApiResponse
|
||||
from .category import Category
|
||||
from .order import Order
|
||||
from .pet import Pet
|
||||
from .tag import Tag
|
||||
from .user import User
|
||||
from swagger_server.models.api_response import ApiResponse
|
||||
from swagger_server.models.category import Category
|
||||
from swagger_server.models.order import Order
|
||||
from swagger_server.models.pet import Pet
|
||||
from swagger_server.models.tag import Tag
|
||||
from swagger_server.models.user import User
|
||||
|
@ -1,28 +1,28 @@
|
||||
# coding: utf-8
|
||||
|
||||
from __future__ import absolute_import
|
||||
from .base_model_ import Model
|
||||
from datetime import date, datetime
|
||||
from typing import List, Dict
|
||||
from ..util import deserialize_model
|
||||
from datetime import date, datetime # noqa: F401
|
||||
|
||||
from typing import List, Dict # noqa: F401
|
||||
|
||||
from swagger_server.models.base_model_ import Model
|
||||
from swagger_server import util
|
||||
|
||||
|
||||
class ApiResponse(Model):
|
||||
"""
|
||||
NOTE: This class is auto generated by the swagger code generator program.
|
||||
"""NOTE: This class is auto generated by the swagger code generator program.
|
||||
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
def __init__(self, code: int=None, type: str=None, message: str=None): # noqa: E501
|
||||
"""ApiResponse - a model defined in Swagger
|
||||
|
||||
def __init__(self, code: int=None, type: str=None, message: str=None):
|
||||
"""
|
||||
ApiResponse - a model defined in Swagger
|
||||
|
||||
:param code: The code of this ApiResponse.
|
||||
:param code: The code of this ApiResponse. # noqa: E501
|
||||
:type code: int
|
||||
:param type: The type of this ApiResponse.
|
||||
:param type: The type of this ApiResponse. # noqa: E501
|
||||
:type type: str
|
||||
:param message: The message of this ApiResponse.
|
||||
:param message: The message of this ApiResponse. # noqa: E501
|
||||
:type message: str
|
||||
"""
|
||||
self.swagger_types = {
|
||||
@ -43,20 +43,19 @@ class ApiResponse(Model):
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, dikt) -> 'ApiResponse':
|
||||
"""
|
||||
Returns the dict as a model
|
||||
"""Returns the dict as a model
|
||||
|
||||
:param dikt: A dict.
|
||||
:type: dict
|
||||
:return: The ApiResponse of this ApiResponse.
|
||||
:return: The ApiResponse of this ApiResponse. # noqa: E501
|
||||
:rtype: ApiResponse
|
||||
"""
|
||||
return deserialize_model(dikt, cls)
|
||||
return util.deserialize_model(dikt, cls)
|
||||
|
||||
@property
|
||||
def code(self) -> int:
|
||||
"""
|
||||
Gets the code of this ApiResponse.
|
||||
"""Gets the code of this ApiResponse.
|
||||
|
||||
|
||||
:return: The code of this ApiResponse.
|
||||
:rtype: int
|
||||
@ -65,8 +64,8 @@ class ApiResponse(Model):
|
||||
|
||||
@code.setter
|
||||
def code(self, code: int):
|
||||
"""
|
||||
Sets the code of this ApiResponse.
|
||||
"""Sets the code of this ApiResponse.
|
||||
|
||||
|
||||
:param code: The code of this ApiResponse.
|
||||
:type code: int
|
||||
@ -76,8 +75,8 @@ class ApiResponse(Model):
|
||||
|
||||
@property
|
||||
def type(self) -> str:
|
||||
"""
|
||||
Gets the type of this ApiResponse.
|
||||
"""Gets the type of this ApiResponse.
|
||||
|
||||
|
||||
:return: The type of this ApiResponse.
|
||||
:rtype: str
|
||||
@ -86,8 +85,8 @@ class ApiResponse(Model):
|
||||
|
||||
@type.setter
|
||||
def type(self, type: str):
|
||||
"""
|
||||
Sets the type of this ApiResponse.
|
||||
"""Sets the type of this ApiResponse.
|
||||
|
||||
|
||||
:param type: The type of this ApiResponse.
|
||||
:type type: str
|
||||
@ -97,8 +96,8 @@ class ApiResponse(Model):
|
||||
|
||||
@property
|
||||
def message(self) -> str:
|
||||
"""
|
||||
Gets the message of this ApiResponse.
|
||||
"""Gets the message of this ApiResponse.
|
||||
|
||||
|
||||
:return: The message of this ApiResponse.
|
||||
:rtype: str
|
||||
@ -107,12 +106,11 @@ class ApiResponse(Model):
|
||||
|
||||
@message.setter
|
||||
def message(self, message: str):
|
||||
"""
|
||||
Sets the message of this ApiResponse.
|
||||
"""Sets the message of this ApiResponse.
|
||||
|
||||
|
||||
:param message: The message of this ApiResponse.
|
||||
:type message: str
|
||||
"""
|
||||
|
||||
self._message = message
|
||||
|
||||
|
@ -1,34 +1,35 @@
|
||||
from pprint import pformat
|
||||
from typing import TypeVar, Type
|
||||
from six import iteritems
|
||||
from ..util import deserialize_model
|
||||
import pprint
|
||||
|
||||
T = TypeVar('T')
|
||||
import six
|
||||
import typing
|
||||
|
||||
from swagger_server import util
|
||||
|
||||
T = typing.TypeVar('T')
|
||||
|
||||
|
||||
class Model(object):
|
||||
# swaggerTypes: The key is attribute name and the value is attribute type.
|
||||
# swaggerTypes: The key is attribute name and the
|
||||
# value is attribute type.
|
||||
swagger_types = {}
|
||||
|
||||
# attributeMap: The key is attribute name and the value is json key in definition.
|
||||
# attributeMap: The key is attribute name and the
|
||||
# value is json key in definition.
|
||||
attribute_map = {}
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], dikt) -> T:
|
||||
"""
|
||||
Returns the dict as a model
|
||||
"""
|
||||
return deserialize_model(dikt, cls)
|
||||
def from_dict(cls: typing.Type[T], dikt) -> T:
|
||||
"""Returns the dict as a model"""
|
||||
return util.deserialize_model(dikt, cls)
|
||||
|
||||
def to_dict(self):
|
||||
"""
|
||||
Returns the model properties as a dict
|
||||
"""Returns the model properties as a dict
|
||||
|
||||
:rtype: dict
|
||||
"""
|
||||
result = {}
|
||||
|
||||
for attr, _ in iteritems(self.swagger_types):
|
||||
for attr, _ in six.iteritems(self.swagger_types):
|
||||
value = getattr(self, attr)
|
||||
if isinstance(value, list):
|
||||
result[attr] = list(map(
|
||||
@ -49,27 +50,20 @@ class Model(object):
|
||||
return result
|
||||
|
||||
def to_str(self):
|
||||
"""
|
||||
Returns the string representation of the model
|
||||
"""Returns the string representation of the model
|
||||
|
||||
:rtype: str
|
||||
"""
|
||||
return pformat(self.to_dict())
|
||||
return pprint.pformat(self.to_dict())
|
||||
|
||||
def __repr__(self):
|
||||
"""
|
||||
For `print` and `pprint`
|
||||
"""
|
||||
"""For `print` and `pprint`"""
|
||||
return self.to_str()
|
||||
|
||||
def __eq__(self, other):
|
||||
"""
|
||||
Returns true if both objects are equal
|
||||
"""
|
||||
"""Returns true if both objects are equal"""
|
||||
return self.__dict__ == other.__dict__
|
||||
|
||||
def __ne__(self, other):
|
||||
"""
|
||||
Returns true if both objects are not equal
|
||||
"""
|
||||
"""Returns true if both objects are not equal"""
|
||||
return not self == other
|
@ -1,26 +1,26 @@
|
||||
# coding: utf-8
|
||||
|
||||
from __future__ import absolute_import
|
||||
from .base_model_ import Model
|
||||
from datetime import date, datetime
|
||||
from typing import List, Dict
|
||||
from ..util import deserialize_model
|
||||
from datetime import date, datetime # noqa: F401
|
||||
|
||||
from typing import List, Dict # noqa: F401
|
||||
|
||||
from swagger_server.models.base_model_ import Model
|
||||
from swagger_server import util
|
||||
|
||||
|
||||
class Category(Model):
|
||||
"""
|
||||
NOTE: This class is auto generated by the swagger code generator program.
|
||||
"""NOTE: This class is auto generated by the swagger code generator program.
|
||||
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
def __init__(self, id: int=None, name: str=None): # noqa: E501
|
||||
"""Category - a model defined in Swagger
|
||||
|
||||
def __init__(self, id: int=None, name: str=None):
|
||||
"""
|
||||
Category - a model defined in Swagger
|
||||
|
||||
:param id: The id of this Category.
|
||||
:param id: The id of this Category. # noqa: E501
|
||||
:type id: int
|
||||
:param name: The name of this Category.
|
||||
:param name: The name of this Category. # noqa: E501
|
||||
:type name: str
|
||||
"""
|
||||
self.swagger_types = {
|
||||
@ -38,20 +38,19 @@ class Category(Model):
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, dikt) -> 'Category':
|
||||
"""
|
||||
Returns the dict as a model
|
||||
"""Returns the dict as a model
|
||||
|
||||
:param dikt: A dict.
|
||||
:type: dict
|
||||
:return: The Category of this Category.
|
||||
:return: The Category of this Category. # noqa: E501
|
||||
:rtype: Category
|
||||
"""
|
||||
return deserialize_model(dikt, cls)
|
||||
return util.deserialize_model(dikt, cls)
|
||||
|
||||
@property
|
||||
def id(self) -> int:
|
||||
"""
|
||||
Gets the id of this Category.
|
||||
"""Gets the id of this Category.
|
||||
|
||||
|
||||
:return: The id of this Category.
|
||||
:rtype: int
|
||||
@ -60,8 +59,8 @@ class Category(Model):
|
||||
|
||||
@id.setter
|
||||
def id(self, id: int):
|
||||
"""
|
||||
Sets the id of this Category.
|
||||
"""Sets the id of this Category.
|
||||
|
||||
|
||||
:param id: The id of this Category.
|
||||
:type id: int
|
||||
@ -71,8 +70,8 @@ class Category(Model):
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
"""
|
||||
Gets the name of this Category.
|
||||
"""Gets the name of this Category.
|
||||
|
||||
|
||||
:return: The name of this Category.
|
||||
:rtype: str
|
||||
@ -81,12 +80,11 @@ class Category(Model):
|
||||
|
||||
@name.setter
|
||||
def name(self, name: str):
|
||||
"""
|
||||
Sets the name of this Category.
|
||||
"""Sets the name of this Category.
|
||||
|
||||
|
||||
:param name: The name of this Category.
|
||||
:type name: str
|
||||
"""
|
||||
|
||||
self._name = name
|
||||
|
||||
|
@ -1,34 +1,34 @@
|
||||
# coding: utf-8
|
||||
|
||||
from __future__ import absolute_import
|
||||
from .base_model_ import Model
|
||||
from datetime import date, datetime
|
||||
from typing import List, Dict
|
||||
from ..util import deserialize_model
|
||||
from datetime import date, datetime # noqa: F401
|
||||
|
||||
from typing import List, Dict # noqa: F401
|
||||
|
||||
from swagger_server.models.base_model_ import Model
|
||||
from swagger_server import util
|
||||
|
||||
|
||||
class Order(Model):
|
||||
"""
|
||||
NOTE: This class is auto generated by the swagger code generator program.
|
||||
"""NOTE: This class is auto generated by the swagger code generator program.
|
||||
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
def __init__(self, id: int=None, pet_id: int=None, quantity: int=None, ship_date: datetime=None, status: str=None, complete: bool=False): # noqa: E501
|
||||
"""Order - a model defined in Swagger
|
||||
|
||||
def __init__(self, id: int=None, pet_id: int=None, quantity: int=None, ship_date: datetime=None, status: str=None, complete: bool=False):
|
||||
"""
|
||||
Order - a model defined in Swagger
|
||||
|
||||
:param id: The id of this Order.
|
||||
:param id: The id of this Order. # noqa: E501
|
||||
:type id: int
|
||||
:param pet_id: The pet_id of this Order.
|
||||
:param pet_id: The pet_id of this Order. # noqa: E501
|
||||
:type pet_id: int
|
||||
:param quantity: The quantity of this Order.
|
||||
:param quantity: The quantity of this Order. # noqa: E501
|
||||
:type quantity: int
|
||||
:param ship_date: The ship_date of this Order.
|
||||
:param ship_date: The ship_date of this Order. # noqa: E501
|
||||
:type ship_date: datetime
|
||||
:param status: The status of this Order.
|
||||
:param status: The status of this Order. # noqa: E501
|
||||
:type status: str
|
||||
:param complete: The complete of this Order.
|
||||
:param complete: The complete of this Order. # noqa: E501
|
||||
:type complete: bool
|
||||
"""
|
||||
self.swagger_types = {
|
||||
@ -58,20 +58,19 @@ class Order(Model):
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, dikt) -> 'Order':
|
||||
"""
|
||||
Returns the dict as a model
|
||||
"""Returns the dict as a model
|
||||
|
||||
:param dikt: A dict.
|
||||
:type: dict
|
||||
:return: The Order of this Order.
|
||||
:return: The Order of this Order. # noqa: E501
|
||||
:rtype: Order
|
||||
"""
|
||||
return deserialize_model(dikt, cls)
|
||||
return util.deserialize_model(dikt, cls)
|
||||
|
||||
@property
|
||||
def id(self) -> int:
|
||||
"""
|
||||
Gets the id of this Order.
|
||||
"""Gets the id of this Order.
|
||||
|
||||
|
||||
:return: The id of this Order.
|
||||
:rtype: int
|
||||
@ -80,8 +79,8 @@ class Order(Model):
|
||||
|
||||
@id.setter
|
||||
def id(self, id: int):
|
||||
"""
|
||||
Sets the id of this Order.
|
||||
"""Sets the id of this Order.
|
||||
|
||||
|
||||
:param id: The id of this Order.
|
||||
:type id: int
|
||||
@ -91,8 +90,8 @@ class Order(Model):
|
||||
|
||||
@property
|
||||
def pet_id(self) -> int:
|
||||
"""
|
||||
Gets the pet_id of this Order.
|
||||
"""Gets the pet_id of this Order.
|
||||
|
||||
|
||||
:return: The pet_id of this Order.
|
||||
:rtype: int
|
||||
@ -101,8 +100,8 @@ class Order(Model):
|
||||
|
||||
@pet_id.setter
|
||||
def pet_id(self, pet_id: int):
|
||||
"""
|
||||
Sets the pet_id of this Order.
|
||||
"""Sets the pet_id of this Order.
|
||||
|
||||
|
||||
:param pet_id: The pet_id of this Order.
|
||||
:type pet_id: int
|
||||
@ -112,8 +111,8 @@ class Order(Model):
|
||||
|
||||
@property
|
||||
def quantity(self) -> int:
|
||||
"""
|
||||
Gets the quantity of this Order.
|
||||
"""Gets the quantity of this Order.
|
||||
|
||||
|
||||
:return: The quantity of this Order.
|
||||
:rtype: int
|
||||
@ -122,8 +121,8 @@ class Order(Model):
|
||||
|
||||
@quantity.setter
|
||||
def quantity(self, quantity: int):
|
||||
"""
|
||||
Sets the quantity of this Order.
|
||||
"""Sets the quantity of this Order.
|
||||
|
||||
|
||||
:param quantity: The quantity of this Order.
|
||||
:type quantity: int
|
||||
@ -133,8 +132,8 @@ class Order(Model):
|
||||
|
||||
@property
|
||||
def ship_date(self) -> datetime:
|
||||
"""
|
||||
Gets the ship_date of this Order.
|
||||
"""Gets the ship_date of this Order.
|
||||
|
||||
|
||||
:return: The ship_date of this Order.
|
||||
:rtype: datetime
|
||||
@ -143,8 +142,8 @@ class Order(Model):
|
||||
|
||||
@ship_date.setter
|
||||
def ship_date(self, ship_date: datetime):
|
||||
"""
|
||||
Sets the ship_date of this Order.
|
||||
"""Sets the ship_date of this Order.
|
||||
|
||||
|
||||
:param ship_date: The ship_date of this Order.
|
||||
:type ship_date: datetime
|
||||
@ -154,9 +153,9 @@ class Order(Model):
|
||||
|
||||
@property
|
||||
def status(self) -> str:
|
||||
"""
|
||||
Gets the status of this Order.
|
||||
Order Status
|
||||
"""Gets the status of this Order.
|
||||
|
||||
Order Status # noqa: E501
|
||||
|
||||
:return: The status of this Order.
|
||||
:rtype: str
|
||||
@ -165,14 +164,14 @@ class Order(Model):
|
||||
|
||||
@status.setter
|
||||
def status(self, status: str):
|
||||
"""
|
||||
Sets the status of this Order.
|
||||
Order Status
|
||||
"""Sets the status of this Order.
|
||||
|
||||
Order Status # noqa: E501
|
||||
|
||||
:param status: The status of this Order.
|
||||
:type status: str
|
||||
"""
|
||||
allowed_values = ["placed", "approved", "delivered"]
|
||||
allowed_values = ["placed", "approved", "delivered"] # noqa: E501
|
||||
if status not in allowed_values:
|
||||
raise ValueError(
|
||||
"Invalid value for `status` ({0}), must be one of {1}"
|
||||
@ -183,8 +182,8 @@ class Order(Model):
|
||||
|
||||
@property
|
||||
def complete(self) -> bool:
|
||||
"""
|
||||
Gets the complete of this Order.
|
||||
"""Gets the complete of this Order.
|
||||
|
||||
|
||||
:return: The complete of this Order.
|
||||
:rtype: bool
|
||||
@ -193,12 +192,11 @@ class Order(Model):
|
||||
|
||||
@complete.setter
|
||||
def complete(self, complete: bool):
|
||||
"""
|
||||
Sets the complete of this Order.
|
||||
"""Sets the complete of this Order.
|
||||
|
||||
|
||||
:param complete: The complete of this Order.
|
||||
:type complete: bool
|
||||
"""
|
||||
|
||||
self._complete = complete
|
||||
|
||||
|
@ -1,36 +1,36 @@
|
||||
# coding: utf-8
|
||||
|
||||
from __future__ import absolute_import
|
||||
from swagger_server.models.category import Category
|
||||
from swagger_server.models.tag import Tag
|
||||
from .base_model_ import Model
|
||||
from datetime import date, datetime
|
||||
from typing import List, Dict
|
||||
from ..util import deserialize_model
|
||||
from datetime import date, datetime # noqa: F401
|
||||
|
||||
from typing import List, Dict # noqa: F401
|
||||
|
||||
from swagger_server.models.base_model_ import Model
|
||||
from swagger_server.models.category import Category # noqa: E501
|
||||
from swagger_server.models.tag import Tag # noqa: E501
|
||||
from swagger_server import util
|
||||
|
||||
|
||||
class Pet(Model):
|
||||
"""
|
||||
NOTE: This class is auto generated by the swagger code generator program.
|
||||
"""NOTE: This class is auto generated by the swagger code generator program.
|
||||
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
def __init__(self, id: int=None, category: Category=None, name: str=None, photo_urls: List[str]=None, tags: List[Tag]=None, status: str=None): # noqa: E501
|
||||
"""Pet - a model defined in Swagger
|
||||
|
||||
def __init__(self, id: int=None, category: Category=None, name: str=None, photo_urls: List[str]=None, tags: List[Tag]=None, status: str=None):
|
||||
"""
|
||||
Pet - a model defined in Swagger
|
||||
|
||||
:param id: The id of this Pet.
|
||||
:param id: The id of this Pet. # noqa: E501
|
||||
:type id: int
|
||||
:param category: The category of this Pet.
|
||||
:param category: The category of this Pet. # noqa: E501
|
||||
:type category: Category
|
||||
:param name: The name of this Pet.
|
||||
:param name: The name of this Pet. # noqa: E501
|
||||
:type name: str
|
||||
:param photo_urls: The photo_urls of this Pet.
|
||||
:param photo_urls: The photo_urls of this Pet. # noqa: E501
|
||||
:type photo_urls: List[str]
|
||||
:param tags: The tags of this Pet.
|
||||
:param tags: The tags of this Pet. # noqa: E501
|
||||
:type tags: List[Tag]
|
||||
:param status: The status of this Pet.
|
||||
:param status: The status of this Pet. # noqa: E501
|
||||
:type status: str
|
||||
"""
|
||||
self.swagger_types = {
|
||||
@ -60,20 +60,19 @@ class Pet(Model):
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, dikt) -> 'Pet':
|
||||
"""
|
||||
Returns the dict as a model
|
||||
"""Returns the dict as a model
|
||||
|
||||
:param dikt: A dict.
|
||||
:type: dict
|
||||
:return: The Pet of this Pet.
|
||||
:return: The Pet of this Pet. # noqa: E501
|
||||
:rtype: Pet
|
||||
"""
|
||||
return deserialize_model(dikt, cls)
|
||||
return util.deserialize_model(dikt, cls)
|
||||
|
||||
@property
|
||||
def id(self) -> int:
|
||||
"""
|
||||
Gets the id of this Pet.
|
||||
"""Gets the id of this Pet.
|
||||
|
||||
|
||||
:return: The id of this Pet.
|
||||
:rtype: int
|
||||
@ -82,8 +81,8 @@ class Pet(Model):
|
||||
|
||||
@id.setter
|
||||
def id(self, id: int):
|
||||
"""
|
||||
Sets the id of this Pet.
|
||||
"""Sets the id of this Pet.
|
||||
|
||||
|
||||
:param id: The id of this Pet.
|
||||
:type id: int
|
||||
@ -93,8 +92,8 @@ class Pet(Model):
|
||||
|
||||
@property
|
||||
def category(self) -> Category:
|
||||
"""
|
||||
Gets the category of this Pet.
|
||||
"""Gets the category of this Pet.
|
||||
|
||||
|
||||
:return: The category of this Pet.
|
||||
:rtype: Category
|
||||
@ -103,8 +102,8 @@ class Pet(Model):
|
||||
|
||||
@category.setter
|
||||
def category(self, category: Category):
|
||||
"""
|
||||
Sets the category of this Pet.
|
||||
"""Sets the category of this Pet.
|
||||
|
||||
|
||||
:param category: The category of this Pet.
|
||||
:type category: Category
|
||||
@ -114,8 +113,8 @@ class Pet(Model):
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
"""
|
||||
Gets the name of this Pet.
|
||||
"""Gets the name of this Pet.
|
||||
|
||||
|
||||
:return: The name of this Pet.
|
||||
:rtype: str
|
||||
@ -124,21 +123,21 @@ class Pet(Model):
|
||||
|
||||
@name.setter
|
||||
def name(self, name: str):
|
||||
"""
|
||||
Sets the name of this Pet.
|
||||
"""Sets the name of this Pet.
|
||||
|
||||
|
||||
:param name: The name of this Pet.
|
||||
:type name: str
|
||||
"""
|
||||
if name is None:
|
||||
raise ValueError("Invalid value for `name`, must not be `None`")
|
||||
raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501
|
||||
|
||||
self._name = name
|
||||
|
||||
@property
|
||||
def photo_urls(self) -> List[str]:
|
||||
"""
|
||||
Gets the photo_urls of this Pet.
|
||||
"""Gets the photo_urls of this Pet.
|
||||
|
||||
|
||||
:return: The photo_urls of this Pet.
|
||||
:rtype: List[str]
|
||||
@ -147,21 +146,21 @@ class Pet(Model):
|
||||
|
||||
@photo_urls.setter
|
||||
def photo_urls(self, photo_urls: List[str]):
|
||||
"""
|
||||
Sets the photo_urls of this Pet.
|
||||
"""Sets the photo_urls of this Pet.
|
||||
|
||||
|
||||
:param photo_urls: The photo_urls of this Pet.
|
||||
:type photo_urls: List[str]
|
||||
"""
|
||||
if photo_urls is None:
|
||||
raise ValueError("Invalid value for `photo_urls`, must not be `None`")
|
||||
raise ValueError("Invalid value for `photo_urls`, must not be `None`") # noqa: E501
|
||||
|
||||
self._photo_urls = photo_urls
|
||||
|
||||
@property
|
||||
def tags(self) -> List[Tag]:
|
||||
"""
|
||||
Gets the tags of this Pet.
|
||||
"""Gets the tags of this Pet.
|
||||
|
||||
|
||||
:return: The tags of this Pet.
|
||||
:rtype: List[Tag]
|
||||
@ -170,8 +169,8 @@ class Pet(Model):
|
||||
|
||||
@tags.setter
|
||||
def tags(self, tags: List[Tag]):
|
||||
"""
|
||||
Sets the tags of this Pet.
|
||||
"""Sets the tags of this Pet.
|
||||
|
||||
|
||||
:param tags: The tags of this Pet.
|
||||
:type tags: List[Tag]
|
||||
@ -181,9 +180,9 @@ class Pet(Model):
|
||||
|
||||
@property
|
||||
def status(self) -> str:
|
||||
"""
|
||||
Gets the status of this Pet.
|
||||
pet status in the store
|
||||
"""Gets the status of this Pet.
|
||||
|
||||
pet status in the store # noqa: E501
|
||||
|
||||
:return: The status of this Pet.
|
||||
:rtype: str
|
||||
@ -192,14 +191,14 @@ class Pet(Model):
|
||||
|
||||
@status.setter
|
||||
def status(self, status: str):
|
||||
"""
|
||||
Sets the status of this Pet.
|
||||
pet status in the store
|
||||
"""Sets the status of this Pet.
|
||||
|
||||
pet status in the store # noqa: E501
|
||||
|
||||
:param status: The status of this Pet.
|
||||
:type status: str
|
||||
"""
|
||||
allowed_values = ["available", "pending", "sold"]
|
||||
allowed_values = ["available", "pending", "sold"] # noqa: E501
|
||||
if status not in allowed_values:
|
||||
raise ValueError(
|
||||
"Invalid value for `status` ({0}), must be one of {1}"
|
||||
@ -207,4 +206,3 @@ class Pet(Model):
|
||||
)
|
||||
|
||||
self._status = status
|
||||
|
||||
|
@ -1,26 +1,26 @@
|
||||
# coding: utf-8
|
||||
|
||||
from __future__ import absolute_import
|
||||
from .base_model_ import Model
|
||||
from datetime import date, datetime
|
||||
from typing import List, Dict
|
||||
from ..util import deserialize_model
|
||||
from datetime import date, datetime # noqa: F401
|
||||
|
||||
from typing import List, Dict # noqa: F401
|
||||
|
||||
from swagger_server.models.base_model_ import Model
|
||||
from swagger_server import util
|
||||
|
||||
|
||||
class Tag(Model):
|
||||
"""
|
||||
NOTE: This class is auto generated by the swagger code generator program.
|
||||
"""NOTE: This class is auto generated by the swagger code generator program.
|
||||
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
def __init__(self, id: int=None, name: str=None): # noqa: E501
|
||||
"""Tag - a model defined in Swagger
|
||||
|
||||
def __init__(self, id: int=None, name: str=None):
|
||||
"""
|
||||
Tag - a model defined in Swagger
|
||||
|
||||
:param id: The id of this Tag.
|
||||
:param id: The id of this Tag. # noqa: E501
|
||||
:type id: int
|
||||
:param name: The name of this Tag.
|
||||
:param name: The name of this Tag. # noqa: E501
|
||||
:type name: str
|
||||
"""
|
||||
self.swagger_types = {
|
||||
@ -38,20 +38,19 @@ class Tag(Model):
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, dikt) -> 'Tag':
|
||||
"""
|
||||
Returns the dict as a model
|
||||
"""Returns the dict as a model
|
||||
|
||||
:param dikt: A dict.
|
||||
:type: dict
|
||||
:return: The Tag of this Tag.
|
||||
:return: The Tag of this Tag. # noqa: E501
|
||||
:rtype: Tag
|
||||
"""
|
||||
return deserialize_model(dikt, cls)
|
||||
return util.deserialize_model(dikt, cls)
|
||||
|
||||
@property
|
||||
def id(self) -> int:
|
||||
"""
|
||||
Gets the id of this Tag.
|
||||
"""Gets the id of this Tag.
|
||||
|
||||
|
||||
:return: The id of this Tag.
|
||||
:rtype: int
|
||||
@ -60,8 +59,8 @@ class Tag(Model):
|
||||
|
||||
@id.setter
|
||||
def id(self, id: int):
|
||||
"""
|
||||
Sets the id of this Tag.
|
||||
"""Sets the id of this Tag.
|
||||
|
||||
|
||||
:param id: The id of this Tag.
|
||||
:type id: int
|
||||
@ -71,8 +70,8 @@ class Tag(Model):
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
"""
|
||||
Gets the name of this Tag.
|
||||
"""Gets the name of this Tag.
|
||||
|
||||
|
||||
:return: The name of this Tag.
|
||||
:rtype: str
|
||||
@ -81,12 +80,11 @@ class Tag(Model):
|
||||
|
||||
@name.setter
|
||||
def name(self, name: str):
|
||||
"""
|
||||
Sets the name of this Tag.
|
||||
"""Sets the name of this Tag.
|
||||
|
||||
|
||||
:param name: The name of this Tag.
|
||||
:type name: str
|
||||
"""
|
||||
|
||||
self._name = name
|
||||
|
||||
|
@ -1,38 +1,38 @@
|
||||
# coding: utf-8
|
||||
|
||||
from __future__ import absolute_import
|
||||
from .base_model_ import Model
|
||||
from datetime import date, datetime
|
||||
from typing import List, Dict
|
||||
from ..util import deserialize_model
|
||||
from datetime import date, datetime # noqa: F401
|
||||
|
||||
from typing import List, Dict # noqa: F401
|
||||
|
||||
from swagger_server.models.base_model_ import Model
|
||||
from swagger_server import util
|
||||
|
||||
|
||||
class User(Model):
|
||||
"""
|
||||
NOTE: This class is auto generated by the swagger code generator program.
|
||||
"""NOTE: This class is auto generated by the swagger code generator program.
|
||||
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
def __init__(self, id: int=None, username: str=None, first_name: str=None, last_name: str=None, email: str=None, password: str=None, phone: str=None, user_status: int=None): # noqa: E501
|
||||
"""User - a model defined in Swagger
|
||||
|
||||
def __init__(self, id: int=None, username: str=None, first_name: str=None, last_name: str=None, email: str=None, password: str=None, phone: str=None, user_status: int=None):
|
||||
"""
|
||||
User - a model defined in Swagger
|
||||
|
||||
:param id: The id of this User.
|
||||
:param id: The id of this User. # noqa: E501
|
||||
:type id: int
|
||||
:param username: The username of this User.
|
||||
:param username: The username of this User. # noqa: E501
|
||||
:type username: str
|
||||
:param first_name: The first_name of this User.
|
||||
:param first_name: The first_name of this User. # noqa: E501
|
||||
:type first_name: str
|
||||
:param last_name: The last_name of this User.
|
||||
:param last_name: The last_name of this User. # noqa: E501
|
||||
:type last_name: str
|
||||
:param email: The email of this User.
|
||||
:param email: The email of this User. # noqa: E501
|
||||
:type email: str
|
||||
:param password: The password of this User.
|
||||
:param password: The password of this User. # noqa: E501
|
||||
:type password: str
|
||||
:param phone: The phone of this User.
|
||||
:param phone: The phone of this User. # noqa: E501
|
||||
:type phone: str
|
||||
:param user_status: The user_status of this User.
|
||||
:param user_status: The user_status of this User. # noqa: E501
|
||||
:type user_status: int
|
||||
"""
|
||||
self.swagger_types = {
|
||||
@ -68,20 +68,19 @@ class User(Model):
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, dikt) -> 'User':
|
||||
"""
|
||||
Returns the dict as a model
|
||||
"""Returns the dict as a model
|
||||
|
||||
:param dikt: A dict.
|
||||
:type: dict
|
||||
:return: The User of this User.
|
||||
:return: The User of this User. # noqa: E501
|
||||
:rtype: User
|
||||
"""
|
||||
return deserialize_model(dikt, cls)
|
||||
return util.deserialize_model(dikt, cls)
|
||||
|
||||
@property
|
||||
def id(self) -> int:
|
||||
"""
|
||||
Gets the id of this User.
|
||||
"""Gets the id of this User.
|
||||
|
||||
|
||||
:return: The id of this User.
|
||||
:rtype: int
|
||||
@ -90,8 +89,8 @@ class User(Model):
|
||||
|
||||
@id.setter
|
||||
def id(self, id: int):
|
||||
"""
|
||||
Sets the id of this User.
|
||||
"""Sets the id of this User.
|
||||
|
||||
|
||||
:param id: The id of this User.
|
||||
:type id: int
|
||||
@ -101,8 +100,8 @@ class User(Model):
|
||||
|
||||
@property
|
||||
def username(self) -> str:
|
||||
"""
|
||||
Gets the username of this User.
|
||||
"""Gets the username of this User.
|
||||
|
||||
|
||||
:return: The username of this User.
|
||||
:rtype: str
|
||||
@ -111,8 +110,8 @@ class User(Model):
|
||||
|
||||
@username.setter
|
||||
def username(self, username: str):
|
||||
"""
|
||||
Sets the username of this User.
|
||||
"""Sets the username of this User.
|
||||
|
||||
|
||||
:param username: The username of this User.
|
||||
:type username: str
|
||||
@ -122,8 +121,8 @@ class User(Model):
|
||||
|
||||
@property
|
||||
def first_name(self) -> str:
|
||||
"""
|
||||
Gets the first_name of this User.
|
||||
"""Gets the first_name of this User.
|
||||
|
||||
|
||||
:return: The first_name of this User.
|
||||
:rtype: str
|
||||
@ -132,8 +131,8 @@ class User(Model):
|
||||
|
||||
@first_name.setter
|
||||
def first_name(self, first_name: str):
|
||||
"""
|
||||
Sets the first_name of this User.
|
||||
"""Sets the first_name of this User.
|
||||
|
||||
|
||||
:param first_name: The first_name of this User.
|
||||
:type first_name: str
|
||||
@ -143,8 +142,8 @@ class User(Model):
|
||||
|
||||
@property
|
||||
def last_name(self) -> str:
|
||||
"""
|
||||
Gets the last_name of this User.
|
||||
"""Gets the last_name of this User.
|
||||
|
||||
|
||||
:return: The last_name of this User.
|
||||
:rtype: str
|
||||
@ -153,8 +152,8 @@ class User(Model):
|
||||
|
||||
@last_name.setter
|
||||
def last_name(self, last_name: str):
|
||||
"""
|
||||
Sets the last_name of this User.
|
||||
"""Sets the last_name of this User.
|
||||
|
||||
|
||||
:param last_name: The last_name of this User.
|
||||
:type last_name: str
|
||||
@ -164,8 +163,8 @@ class User(Model):
|
||||
|
||||
@property
|
||||
def email(self) -> str:
|
||||
"""
|
||||
Gets the email of this User.
|
||||
"""Gets the email of this User.
|
||||
|
||||
|
||||
:return: The email of this User.
|
||||
:rtype: str
|
||||
@ -174,8 +173,8 @@ class User(Model):
|
||||
|
||||
@email.setter
|
||||
def email(self, email: str):
|
||||
"""
|
||||
Sets the email of this User.
|
||||
"""Sets the email of this User.
|
||||
|
||||
|
||||
:param email: The email of this User.
|
||||
:type email: str
|
||||
@ -185,8 +184,8 @@ class User(Model):
|
||||
|
||||
@property
|
||||
def password(self) -> str:
|
||||
"""
|
||||
Gets the password of this User.
|
||||
"""Gets the password of this User.
|
||||
|
||||
|
||||
:return: The password of this User.
|
||||
:rtype: str
|
||||
@ -195,8 +194,8 @@ class User(Model):
|
||||
|
||||
@password.setter
|
||||
def password(self, password: str):
|
||||
"""
|
||||
Sets the password of this User.
|
||||
"""Sets the password of this User.
|
||||
|
||||
|
||||
:param password: The password of this User.
|
||||
:type password: str
|
||||
@ -206,8 +205,8 @@ class User(Model):
|
||||
|
||||
@property
|
||||
def phone(self) -> str:
|
||||
"""
|
||||
Gets the phone of this User.
|
||||
"""Gets the phone of this User.
|
||||
|
||||
|
||||
:return: The phone of this User.
|
||||
:rtype: str
|
||||
@ -216,8 +215,8 @@ class User(Model):
|
||||
|
||||
@phone.setter
|
||||
def phone(self, phone: str):
|
||||
"""
|
||||
Sets the phone of this User.
|
||||
"""Sets the phone of this User.
|
||||
|
||||
|
||||
:param phone: The phone of this User.
|
||||
:type phone: str
|
||||
@ -227,9 +226,9 @@ class User(Model):
|
||||
|
||||
@property
|
||||
def user_status(self) -> int:
|
||||
"""
|
||||
Gets the user_status of this User.
|
||||
User Status
|
||||
"""Gets the user_status of this User.
|
||||
|
||||
User Status # noqa: E501
|
||||
|
||||
:return: The user_status of this User.
|
||||
:rtype: int
|
||||
@ -238,13 +237,12 @@ class User(Model):
|
||||
|
||||
@user_status.setter
|
||||
def user_status(self, user_status: int):
|
||||
"""
|
||||
Sets the user_status of this User.
|
||||
User Status
|
||||
"""Sets the user_status of this User.
|
||||
|
||||
User Status # noqa: E501
|
||||
|
||||
:param user_status: The user_status of this User.
|
||||
:type user_status: int
|
||||
"""
|
||||
|
||||
self._user_status = user_status
|
||||
|
||||
|
@ -1,8 +1,10 @@
|
||||
from flask_testing import TestCase
|
||||
from ..encoder import JSONEncoder
|
||||
import connexion
|
||||
import logging
|
||||
|
||||
import connexion
|
||||
from flask_testing import TestCase
|
||||
|
||||
from swagger_server.encoder import JSONEncoder
|
||||
|
||||
|
||||
class BaseTestCase(TestCase):
|
||||
|
||||
|
@ -2,115 +2,124 @@
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
from swagger_server.models.api_response import ApiResponse
|
||||
from swagger_server.models.pet import Pet
|
||||
from . import BaseTestCase
|
||||
from six import BytesIO
|
||||
from flask import json
|
||||
from six import BytesIO
|
||||
|
||||
from swagger_server.models.api_response import ApiResponse # noqa: E501
|
||||
from swagger_server.models.pet import Pet # noqa: E501
|
||||
from swagger_server.test import BaseTestCase
|
||||
|
||||
|
||||
class TestPetController(BaseTestCase):
|
||||
"""PetController integration test stubs"""
|
||||
|
||||
def test_add_pet(self):
|
||||
"""
|
||||
Test case for add_pet
|
||||
"""Test case for add_pet
|
||||
|
||||
Add a new pet to the store
|
||||
"""
|
||||
body = Pet()
|
||||
response = self.client.open('/v2/pet',
|
||||
response = self.client.open(
|
||||
'/v2/pet',
|
||||
method='POST',
|
||||
data=json.dumps(body),
|
||||
content_type='application/json')
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_delete_pet(self):
|
||||
"""
|
||||
Test case for delete_pet
|
||||
"""Test case for delete_pet
|
||||
|
||||
Deletes a pet
|
||||
"""
|
||||
headers = [('api_key', 'api_key_example')]
|
||||
response = self.client.open('/v2/pet/{petId}'.format(petId=789),
|
||||
response = self.client.open(
|
||||
'/v2/pet/{petId}'.format(petId=789),
|
||||
method='DELETE',
|
||||
headers=headers)
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_find_pets_by_status(self):
|
||||
"""
|
||||
Test case for find_pets_by_status
|
||||
"""Test case for find_pets_by_status
|
||||
|
||||
Finds Pets by status
|
||||
"""
|
||||
query_string = [('status', 'available')]
|
||||
response = self.client.open('/v2/pet/findByStatus',
|
||||
response = self.client.open(
|
||||
'/v2/pet/findByStatus',
|
||||
method='GET',
|
||||
query_string=query_string)
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_find_pets_by_tags(self):
|
||||
"""
|
||||
Test case for find_pets_by_tags
|
||||
"""Test case for find_pets_by_tags
|
||||
|
||||
Finds Pets by tags
|
||||
"""
|
||||
query_string = [('tags', 'tags_example')]
|
||||
response = self.client.open('/v2/pet/findByTags',
|
||||
response = self.client.open(
|
||||
'/v2/pet/findByTags',
|
||||
method='GET',
|
||||
query_string=query_string)
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_get_pet_by_id(self):
|
||||
"""
|
||||
Test case for get_pet_by_id
|
||||
"""Test case for get_pet_by_id
|
||||
|
||||
Find pet by ID
|
||||
"""
|
||||
response = self.client.open('/v2/pet/{petId}'.format(petId=789),
|
||||
response = self.client.open(
|
||||
'/v2/pet/{petId}'.format(petId=789),
|
||||
method='GET')
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_update_pet(self):
|
||||
"""
|
||||
Test case for update_pet
|
||||
"""Test case for update_pet
|
||||
|
||||
Update an existing pet
|
||||
"""
|
||||
body = Pet()
|
||||
response = self.client.open('/v2/pet',
|
||||
response = self.client.open(
|
||||
'/v2/pet',
|
||||
method='PUT',
|
||||
data=json.dumps(body),
|
||||
content_type='application/json')
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_update_pet_with_form(self):
|
||||
"""
|
||||
Test case for update_pet_with_form
|
||||
"""Test case for update_pet_with_form
|
||||
|
||||
Updates a pet in the store with form data
|
||||
"""
|
||||
data = dict(name='name_example',
|
||||
status='status_example')
|
||||
response = self.client.open('/v2/pet/{petId}'.format(petId=789),
|
||||
response = self.client.open(
|
||||
'/v2/pet/{petId}'.format(petId=789),
|
||||
method='POST',
|
||||
data=data,
|
||||
content_type='application/x-www-form-urlencoded')
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_upload_file(self):
|
||||
"""
|
||||
Test case for upload_file
|
||||
"""Test case for upload_file
|
||||
|
||||
uploads an image
|
||||
"""
|
||||
data = dict(additionalMetadata='additionalMetadata_example',
|
||||
file=(BytesIO(b'some file data'), 'file.txt'))
|
||||
response = self.client.open('/v2/pet/{petId}/uploadImage'.format(petId=789),
|
||||
response = self.client.open(
|
||||
'/v2/pet/{petId}/uploadImage'.format(petId=789),
|
||||
method='POST',
|
||||
data=data,
|
||||
content_type='multipart/form-data')
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -2,57 +2,62 @@
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
from swagger_server.models.order import Order
|
||||
from . import BaseTestCase
|
||||
from six import BytesIO
|
||||
from flask import json
|
||||
from six import BytesIO
|
||||
|
||||
from swagger_server.models.order import Order # noqa: E501
|
||||
from swagger_server.test import BaseTestCase
|
||||
|
||||
|
||||
class TestStoreController(BaseTestCase):
|
||||
"""StoreController integration test stubs"""
|
||||
|
||||
def test_delete_order(self):
|
||||
"""
|
||||
Test case for delete_order
|
||||
"""Test case for delete_order
|
||||
|
||||
Delete purchase order by ID
|
||||
"""
|
||||
response = self.client.open('/v2/store/order/{orderId}'.format(orderId='orderId_example'),
|
||||
response = self.client.open(
|
||||
'/v2/store/order/{orderId}'.format(orderId='orderId_example'),
|
||||
method='DELETE')
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_get_inventory(self):
|
||||
"""
|
||||
Test case for get_inventory
|
||||
"""Test case for get_inventory
|
||||
|
||||
Returns pet inventories by status
|
||||
"""
|
||||
response = self.client.open('/v2/store/inventory',
|
||||
response = self.client.open(
|
||||
'/v2/store/inventory',
|
||||
method='GET')
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_get_order_by_id(self):
|
||||
"""
|
||||
Test case for get_order_by_id
|
||||
"""Test case for get_order_by_id
|
||||
|
||||
Find purchase order by ID
|
||||
"""
|
||||
response = self.client.open('/v2/store/order/{orderId}'.format(orderId=5),
|
||||
response = self.client.open(
|
||||
'/v2/store/order/{orderId}'.format(orderId=5),
|
||||
method='GET')
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_place_order(self):
|
||||
"""
|
||||
Test case for place_order
|
||||
"""Test case for place_order
|
||||
|
||||
Place an order for a pet
|
||||
"""
|
||||
body = Order()
|
||||
response = self.client.open('/v2/store/order',
|
||||
response = self.client.open(
|
||||
'/v2/store/order',
|
||||
method='POST',
|
||||
data=json.dumps(body),
|
||||
content_type='application/json')
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -2,109 +2,118 @@
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
from swagger_server.models.user import User
|
||||
from . import BaseTestCase
|
||||
from six import BytesIO
|
||||
from flask import json
|
||||
from six import BytesIO
|
||||
|
||||
from swagger_server.models.user import User # noqa: E501
|
||||
from swagger_server.test import BaseTestCase
|
||||
|
||||
|
||||
class TestUserController(BaseTestCase):
|
||||
"""UserController integration test stubs"""
|
||||
|
||||
def test_create_user(self):
|
||||
"""
|
||||
Test case for create_user
|
||||
"""Test case for create_user
|
||||
|
||||
Create user
|
||||
"""
|
||||
body = User()
|
||||
response = self.client.open('/v2/user',
|
||||
response = self.client.open(
|
||||
'/v2/user',
|
||||
method='POST',
|
||||
data=json.dumps(body),
|
||||
content_type='application/json')
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_create_users_with_array_input(self):
|
||||
"""
|
||||
Test case for create_users_with_array_input
|
||||
"""Test case for create_users_with_array_input
|
||||
|
||||
Creates list of users with given input array
|
||||
"""
|
||||
body = [User()]
|
||||
response = self.client.open('/v2/user/createWithArray',
|
||||
response = self.client.open(
|
||||
'/v2/user/createWithArray',
|
||||
method='POST',
|
||||
data=json.dumps(body),
|
||||
content_type='application/json')
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_create_users_with_list_input(self):
|
||||
"""
|
||||
Test case for create_users_with_list_input
|
||||
"""Test case for create_users_with_list_input
|
||||
|
||||
Creates list of users with given input array
|
||||
"""
|
||||
body = [User()]
|
||||
response = self.client.open('/v2/user/createWithList',
|
||||
response = self.client.open(
|
||||
'/v2/user/createWithList',
|
||||
method='POST',
|
||||
data=json.dumps(body),
|
||||
content_type='application/json')
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_delete_user(self):
|
||||
"""
|
||||
Test case for delete_user
|
||||
"""Test case for delete_user
|
||||
|
||||
Delete user
|
||||
"""
|
||||
response = self.client.open('/v2/user/{username}'.format(username='username_example'),
|
||||
response = self.client.open(
|
||||
'/v2/user/{username}'.format(username='username_example'),
|
||||
method='DELETE')
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_get_user_by_name(self):
|
||||
"""
|
||||
Test case for get_user_by_name
|
||||
"""Test case for get_user_by_name
|
||||
|
||||
Get user by user name
|
||||
"""
|
||||
response = self.client.open('/v2/user/{username}'.format(username='username_example'),
|
||||
response = self.client.open(
|
||||
'/v2/user/{username}'.format(username='username_example'),
|
||||
method='GET')
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_login_user(self):
|
||||
"""
|
||||
Test case for login_user
|
||||
"""Test case for login_user
|
||||
|
||||
Logs user into the system
|
||||
"""
|
||||
query_string = [('username', 'username_example'),
|
||||
('password', 'password_example')]
|
||||
response = self.client.open('/v2/user/login',
|
||||
response = self.client.open(
|
||||
'/v2/user/login',
|
||||
method='GET',
|
||||
query_string=query_string)
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_logout_user(self):
|
||||
"""
|
||||
Test case for logout_user
|
||||
"""Test case for logout_user
|
||||
|
||||
Logs out current logged in user session
|
||||
"""
|
||||
response = self.client.open('/v2/user/logout',
|
||||
response = self.client.open(
|
||||
'/v2/user/logout',
|
||||
method='GET')
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_update_user(self):
|
||||
"""
|
||||
Test case for update_user
|
||||
"""Test case for update_user
|
||||
|
||||
Updated user
|
||||
"""
|
||||
body = User()
|
||||
response = self.client.open('/v2/user/{username}'.format(username='username_example'),
|
||||
response = self.client.open(
|
||||
'/v2/user/{username}'.format(username='username_example'),
|
||||
method='PUT',
|
||||
data=json.dumps(body),
|
||||
content_type='application/json')
|
||||
self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -1,11 +1,11 @@
|
||||
from typing import GenericMeta
|
||||
from datetime import datetime, date
|
||||
from six import integer_types, iteritems
|
||||
import datetime
|
||||
|
||||
import six
|
||||
import typing
|
||||
|
||||
|
||||
def _deserialize(data, klass):
|
||||
"""
|
||||
Deserializes dict, list, str into an object.
|
||||
"""Deserializes dict, list, str into an object.
|
||||
|
||||
:param data: dict, list or str.
|
||||
:param klass: class literal, or string of class name.
|
||||
@ -15,15 +15,15 @@ def _deserialize(data, klass):
|
||||
if data is None:
|
||||
return None
|
||||
|
||||
if klass in integer_types or klass in (float, str, bool):
|
||||
if klass in six.integer_types or klass in (float, str, bool):
|
||||
return _deserialize_primitive(data, klass)
|
||||
elif klass == object:
|
||||
return _deserialize_object(data)
|
||||
elif klass == date:
|
||||
elif klass == datetime.date:
|
||||
return deserialize_date(data)
|
||||
elif klass == datetime:
|
||||
elif klass == datetime.datetime:
|
||||
return deserialize_datetime(data)
|
||||
elif type(klass) == GenericMeta:
|
||||
elif type(klass) == typing.GenericMeta:
|
||||
if klass.__extra__ == list:
|
||||
return _deserialize_list(data, klass.__args__[0])
|
||||
if klass.__extra__ == dict:
|
||||
@ -33,8 +33,7 @@ def _deserialize(data, klass):
|
||||
|
||||
|
||||
def _deserialize_primitive(data, klass):
|
||||
"""
|
||||
Deserializes to primitive type.
|
||||
"""Deserializes to primitive type.
|
||||
|
||||
:param data: data to deserialize.
|
||||
:param klass: class literal.
|
||||
@ -52,8 +51,7 @@ def _deserialize_primitive(data, klass):
|
||||
|
||||
|
||||
def _deserialize_object(value):
|
||||
"""
|
||||
Return a original value.
|
||||
"""Return a original value.
|
||||
|
||||
:return: object.
|
||||
"""
|
||||
@ -61,8 +59,7 @@ def _deserialize_object(value):
|
||||
|
||||
|
||||
def deserialize_date(string):
|
||||
"""
|
||||
Deserializes string to date.
|
||||
"""Deserializes string to date.
|
||||
|
||||
:param string: str.
|
||||
:type string: str
|
||||
@ -77,8 +74,7 @@ def deserialize_date(string):
|
||||
|
||||
|
||||
def deserialize_datetime(string):
|
||||
"""
|
||||
Deserializes string to datetime.
|
||||
"""Deserializes string to datetime.
|
||||
|
||||
The string should be in iso8601 datetime format.
|
||||
|
||||
@ -95,8 +91,7 @@ def deserialize_datetime(string):
|
||||
|
||||
|
||||
def deserialize_model(data, klass):
|
||||
"""
|
||||
Deserializes list or dict to model.
|
||||
"""Deserializes list or dict to model.
|
||||
|
||||
:param data: dict, list.
|
||||
:type data: dict | list
|
||||
@ -108,7 +103,7 @@ def deserialize_model(data, klass):
|
||||
if not instance.swagger_types:
|
||||
return data
|
||||
|
||||
for attr, attr_type in iteritems(instance.swagger_types):
|
||||
for attr, attr_type in six.iteritems(instance.swagger_types):
|
||||
if data is not None \
|
||||
and instance.attribute_map[attr] in data \
|
||||
and isinstance(data, (list, dict)):
|
||||
@ -119,8 +114,7 @@ def deserialize_model(data, klass):
|
||||
|
||||
|
||||
def _deserialize_list(data, boxed_type):
|
||||
"""
|
||||
Deserializes a list and its elements.
|
||||
"""Deserializes a list and its elements.
|
||||
|
||||
:param data: list to deserialize.
|
||||
:type data: list
|
||||
@ -133,10 +127,8 @@ def _deserialize_list(data, boxed_type):
|
||||
for sub_data in data]
|
||||
|
||||
|
||||
|
||||
def _deserialize_dict(data, boxed_type):
|
||||
"""
|
||||
Deserializes a dict and its elements.
|
||||
"""Deserializes a dict and its elements.
|
||||
|
||||
:param data: dict to deserialize.
|
||||
:type data: dict
|
||||
@ -146,4 +138,4 @@ def _deserialize_dict(data, boxed_type):
|
||||
:rtype: dict
|
||||
"""
|
||||
return {k: _deserialize(v, boxed_type)
|
||||
for k, v in iteritems(data)}
|
||||
for k, v in six.iteritems(data)}
|
||||
|
Loading…
x
Reference in New Issue
Block a user