forked from loafle/openapi-generator-original
Clean-up - Unnecessary trailing underscores in Python Flask, AIOHttp, BluePlanet (#16249)
* Remove trailing underscore in security_controller_.py and base_model_.py * Regenerating sample files * Clean-up files with trailing underscore in samples * Update security extension to use the new security_controller * Regenerate unmaintained samples
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import connexion
|
||||
|
||||
@@ -11,6 +11,7 @@ def main():
|
||||
app.add_api('openapi.yaml',
|
||||
arguments={'title': 'OpenAPI Petstore'},
|
||||
pythonic_params=True)
|
||||
|
||||
app.run(port=8080)
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import connexion
|
||||
import six
|
||||
from typing import Dict
|
||||
from typing import Tuple
|
||||
from typing import Union
|
||||
|
||||
from openapi_server.models.api_response import ApiResponse # noqa: E501
|
||||
from openapi_server.models.pet import Pet # noqa: E501
|
||||
@@ -17,7 +20,7 @@ def add_pet(pet): # noqa: E501
|
||||
:param pet: Pet object that needs to be added to the store
|
||||
:type pet: dict | bytes
|
||||
|
||||
:rtype: None
|
||||
:rtype: Union[None, Tuple[None, int], Tuple[None, int, Dict[str, str]]
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
pet = Pet.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
@@ -34,7 +37,7 @@ def delete_pet(pet_id, api_key=None): # noqa: E501
|
||||
:param api_key:
|
||||
:type api_key: str
|
||||
|
||||
:rtype: None
|
||||
:rtype: Union[None, Tuple[None, int], Tuple[None, int, Dict[str, str]]
|
||||
"""
|
||||
return 'do some magic!'
|
||||
|
||||
@@ -47,7 +50,7 @@ def find_pets_by_status(status): # noqa: E501
|
||||
:param status: Status values that need to be considered for filter
|
||||
:type status: List[str]
|
||||
|
||||
:rtype: List[Pet]
|
||||
:rtype: Union[List[Pet], Tuple[List[Pet], int], Tuple[List[Pet], int, Dict[str, str]]
|
||||
"""
|
||||
return 'do some magic!'
|
||||
|
||||
@@ -60,7 +63,7 @@ def find_pets_by_tags(tags): # noqa: E501
|
||||
:param tags: Tags to filter by
|
||||
:type tags: List[str]
|
||||
|
||||
:rtype: List[Pet]
|
||||
:rtype: Union[List[Pet], Tuple[List[Pet], int], Tuple[List[Pet], int, Dict[str, str]]
|
||||
"""
|
||||
return 'do some magic!'
|
||||
|
||||
@@ -73,7 +76,7 @@ def get_pet_by_id(pet_id): # noqa: E501
|
||||
:param pet_id: ID of pet to return
|
||||
:type pet_id: int
|
||||
|
||||
:rtype: Pet
|
||||
:rtype: Union[Pet, Tuple[Pet, int], Tuple[Pet, int, Dict[str, str]]
|
||||
"""
|
||||
return 'do some magic!'
|
||||
|
||||
@@ -86,7 +89,7 @@ def update_pet(pet): # noqa: E501
|
||||
:param pet: Pet object that needs to be added to the store
|
||||
:type pet: dict | bytes
|
||||
|
||||
:rtype: None
|
||||
:rtype: Union[None, Tuple[None, int], Tuple[None, int, Dict[str, str]]
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
pet = Pet.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
@@ -103,7 +106,7 @@ def update_pet_status_with_enum(pet_id, status): # noqa: E501
|
||||
:param status: The required status
|
||||
:type status: dict | bytes
|
||||
|
||||
:rtype: Pet
|
||||
:rtype: Union[Pet, Tuple[Pet, int], Tuple[Pet, int, Dict[str, str]]
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
status = StatusEnum.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
@@ -120,7 +123,7 @@ def update_pet_with_form(pet_id, pet_form=None): # noqa: E501
|
||||
:param pet_form:
|
||||
:type pet_form: dict | bytes
|
||||
|
||||
:rtype: None
|
||||
:rtype: Union[None, Tuple[None, int], Tuple[None, int, Dict[str, str]]
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
pet_form = PetForm.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
@@ -137,7 +140,7 @@ def upload_file(pet_id, upload_form=None): # noqa: E501
|
||||
:param upload_form:
|
||||
:type upload_form: dict | bytes
|
||||
|
||||
:rtype: ApiResponse
|
||||
:rtype: Union[ApiResponse, Tuple[ApiResponse, int], Tuple[ApiResponse, int, Dict[str, str]]
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
upload_form = UploadForm.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
|
||||
@@ -1,6 +1,35 @@
|
||||
from typing import List
|
||||
|
||||
|
||||
def info_from_petstore_auth(token):
|
||||
"""
|
||||
Validate and decode token.
|
||||
Returned value will be passed in 'token_info' parameter of your operation function, if there is one.
|
||||
'sub' or 'uid' will be set in 'user' parameter of your operation function, if there is one.
|
||||
'scope' or 'scopes' will be passed to scope validation function.
|
||||
|
||||
:param token Token provided by Authorization header
|
||||
:type token: str
|
||||
:return: Decoded token information or None if token is invalid
|
||||
:rtype: dict | None
|
||||
"""
|
||||
return {'scopes': ['read:pets', 'write:pets'], 'uid': 'user_id'}
|
||||
|
||||
|
||||
def validate_scope_petstore_auth(required_scopes, token_scopes):
|
||||
"""
|
||||
Validate required scopes are included in token scope
|
||||
|
||||
:param required_scopes Required scope to access called API
|
||||
:type required_scopes: List[str]
|
||||
:param token_scopes Scope present in token
|
||||
:type token_scopes: List[str]
|
||||
:return: True if access to called API is allowed
|
||||
:rtype: bool
|
||||
"""
|
||||
return set(required_scopes).issubset(set(token_scopes))
|
||||
|
||||
|
||||
def info_from_api_key(api_key, required_scopes):
|
||||
"""
|
||||
Check and retrieve authentication information from api_key.
|
||||
@@ -32,33 +61,3 @@ def info_from_auth_cookie(api_key, required_scopes):
|
||||
"""
|
||||
return {'uid': 'user_id'}
|
||||
|
||||
|
||||
def info_from_petstore_auth(token):
|
||||
"""
|
||||
Validate and decode token.
|
||||
Returned value will be passed in 'token_info' parameter of your operation function, if there is one.
|
||||
'sub' or 'uid' will be set in 'user' parameter of your operation function, if there is one.
|
||||
'scope' or 'scopes' will be passed to scope validation function.
|
||||
|
||||
:param token Token provided by Authorization header
|
||||
:type token: str
|
||||
:return: Decoded token information or None if token is invalid
|
||||
:rtype: dict | None
|
||||
"""
|
||||
return {'scopes': ['read:pets', 'write:pets'], 'uid': 'user_id'}
|
||||
|
||||
|
||||
def validate_scope_petstore_auth(required_scopes, token_scopes):
|
||||
"""
|
||||
Validate required scopes are included in token scope
|
||||
|
||||
:param required_scopes Required scope to access called API
|
||||
:type required_scopes: List[str]
|
||||
:param token_scopes Scope present in token
|
||||
:type token_scopes: List[str]
|
||||
:return: True if access to called API is allowed
|
||||
:rtype: bool
|
||||
"""
|
||||
return set(required_scopes).issubset(set(token_scopes))
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import connexion
|
||||
import six
|
||||
from typing import Dict
|
||||
from typing import Tuple
|
||||
from typing import Union
|
||||
|
||||
from openapi_server.models.order import Order # noqa: E501
|
||||
from openapi_server import util
|
||||
@@ -13,7 +16,7 @@ def delete_order(order_id): # noqa: E501
|
||||
:param order_id: ID of the order that needs to be deleted
|
||||
:type order_id: str
|
||||
|
||||
:rtype: None
|
||||
:rtype: Union[None, Tuple[None, int], Tuple[None, int, Dict[str, str]]
|
||||
"""
|
||||
return 'do some magic!'
|
||||
|
||||
@@ -24,7 +27,7 @@ def get_inventory(): # noqa: E501
|
||||
Returns a map of status codes to quantities # noqa: E501
|
||||
|
||||
|
||||
:rtype: Dict[str, int]
|
||||
:rtype: Union[Dict[str, int], Tuple[Dict[str, int], int], Tuple[Dict[str, int], int, Dict[str, str]]
|
||||
"""
|
||||
return 'do some magic!'
|
||||
|
||||
@@ -37,7 +40,7 @@ def get_order_by_id(order_id): # noqa: E501
|
||||
:param order_id: ID of pet that needs to be fetched
|
||||
:type order_id: int
|
||||
|
||||
:rtype: Order
|
||||
:rtype: Union[Order, Tuple[Order, int], Tuple[Order, int, Dict[str, str]]
|
||||
"""
|
||||
return 'do some magic!'
|
||||
|
||||
@@ -50,7 +53,7 @@ def place_order(order): # noqa: E501
|
||||
:param order: order placed for purchasing the pet
|
||||
:type order: dict | bytes
|
||||
|
||||
:rtype: Order
|
||||
:rtype: Union[Order, Tuple[Order, int], Tuple[Order, int, Dict[str, str]]
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
order = Order.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import connexion
|
||||
import six
|
||||
from typing import Dict
|
||||
from typing import Tuple
|
||||
from typing import Union
|
||||
|
||||
from openapi_server.models.user import User # noqa: E501
|
||||
from openapi_server import util
|
||||
@@ -13,7 +16,7 @@ def create_user(user): # noqa: E501
|
||||
:param user: Created user object
|
||||
:type user: dict | bytes
|
||||
|
||||
:rtype: None
|
||||
:rtype: Union[None, Tuple[None, int], Tuple[None, int, Dict[str, str]]
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
user = User.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
@@ -28,7 +31,7 @@ def create_users_with_array_input(user): # noqa: E501
|
||||
:param user: List of user objects
|
||||
:type user: list | bytes
|
||||
|
||||
:rtype: None
|
||||
:rtype: Union[None, Tuple[None, int], Tuple[None, int, Dict[str, str]]
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
user = [User.from_dict(d) for d in connexion.request.get_json()] # noqa: E501
|
||||
@@ -43,7 +46,7 @@ def create_users_with_list_input(user): # noqa: E501
|
||||
:param user: List of user objects
|
||||
:type user: list | bytes
|
||||
|
||||
:rtype: None
|
||||
:rtype: Union[None, Tuple[None, int], Tuple[None, int, Dict[str, str]]
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
user = [User.from_dict(d) for d in connexion.request.get_json()] # noqa: E501
|
||||
@@ -58,7 +61,7 @@ def delete_user(username): # noqa: E501
|
||||
:param username: The name that needs to be deleted
|
||||
:type username: str
|
||||
|
||||
:rtype: None
|
||||
:rtype: Union[None, Tuple[None, int], Tuple[None, int, Dict[str, str]]
|
||||
"""
|
||||
return 'do some magic!'
|
||||
|
||||
@@ -71,7 +74,7 @@ def get_user_by_name(username): # noqa: E501
|
||||
:param username: The name that needs to be fetched. Use user1 for testing.
|
||||
:type username: str
|
||||
|
||||
:rtype: User
|
||||
:rtype: Union[User, Tuple[User, int], Tuple[User, int, Dict[str, str]]
|
||||
"""
|
||||
return 'do some magic!'
|
||||
|
||||
@@ -86,7 +89,7 @@ def login_user(username, password): # noqa: E501
|
||||
:param password: The password for login in clear text
|
||||
:type password: str
|
||||
|
||||
:rtype: str
|
||||
:rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]]
|
||||
"""
|
||||
return 'do some magic!'
|
||||
|
||||
@@ -97,7 +100,7 @@ def logout_user(): # noqa: E501
|
||||
# noqa: E501
|
||||
|
||||
|
||||
:rtype: None
|
||||
:rtype: Union[None, Tuple[None, int], Tuple[None, int, Dict[str, str]]
|
||||
"""
|
||||
return 'do some magic!'
|
||||
|
||||
@@ -112,7 +115,7 @@ def update_user(username, user): # noqa: E501
|
||||
:param user: Updated user object
|
||||
:type user: dict | bytes
|
||||
|
||||
:rtype: None
|
||||
:rtype: Union[None, Tuple[None, int], Tuple[None, int, Dict[str, str]]
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
user = User.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from connexion.apps.flask_app import FlaskJSONEncoder
|
||||
import six
|
||||
|
||||
from openapi_server.models.base_model_ import Model
|
||||
from openapi_server.models.base_model import Model
|
||||
|
||||
|
||||
class JSONEncoder(FlaskJSONEncoder):
|
||||
|
||||
@@ -7,8 +7,6 @@ from openapi_server.models.api_response import ApiResponse
|
||||
from openapi_server.models.category import Category
|
||||
from openapi_server.models.order import Order
|
||||
from openapi_server.models.pet import Pet
|
||||
from openapi_server.models.pet_form import PetForm
|
||||
from openapi_server.models.status_enum import StatusEnum
|
||||
from openapi_server.models.tag import Tag
|
||||
from openapi_server.models.upload_form import UploadForm
|
||||
from openapi_server.models.user import User
|
||||
|
||||
@@ -5,7 +5,7 @@ from datetime import date, datetime # noqa: F401
|
||||
|
||||
from typing import List, Dict # noqa: F401
|
||||
|
||||
from openapi_server.models.base_model_ import Model
|
||||
from openapi_server.models.base_model import Model
|
||||
from openapi_server import util
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ class ApiResponse(Model):
|
||||
self._message = message
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, dikt):
|
||||
def from_dict(cls, dikt) -> 'ApiResponse':
|
||||
"""Returns the dict as a model
|
||||
|
||||
:param dikt: A dict.
|
||||
|
||||
@@ -1,21 +1,24 @@
|
||||
import pprint
|
||||
|
||||
import six
|
||||
import typing
|
||||
|
||||
from openapi_server import util
|
||||
|
||||
T = typing.TypeVar('T')
|
||||
|
||||
|
||||
class Model(object):
|
||||
# openapiTypes: The key is attribute name and the
|
||||
# value is attribute type.
|
||||
openapi_types = {}
|
||||
openapi_types: typing.Dict[str, type] = {}
|
||||
|
||||
# attributeMap: The key is attribute name and the
|
||||
# value is json key in definition.
|
||||
attribute_map = {}
|
||||
attribute_map: typing.Dict[str, str] = {}
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, dikt):
|
||||
def from_dict(cls: typing.Type[T], dikt) -> T:
|
||||
"""Returns the dict as a model"""
|
||||
return util.deserialize_model(dikt, cls)
|
||||
|
||||
@@ -5,7 +5,7 @@ from datetime import date, datetime # noqa: F401
|
||||
|
||||
from typing import List, Dict # noqa: F401
|
||||
|
||||
from openapi_server.models.base_model_ import Model
|
||||
from openapi_server.models.base_model import Model
|
||||
import re
|
||||
from openapi_server import util
|
||||
|
||||
@@ -21,12 +21,12 @@ class Category(Model):
|
||||
"""Category - a model defined in OpenAPI
|
||||
|
||||
:param id: The id of this Category. # noqa: E501
|
||||
:type id: long
|
||||
:type id: int
|
||||
:param name: The name of this Category. # noqa: E501
|
||||
:type name: str
|
||||
"""
|
||||
self.openapi_types = {
|
||||
'id': long,
|
||||
'id': int,
|
||||
'name': str
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ class Category(Model):
|
||||
self._name = name
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, dikt):
|
||||
def from_dict(cls, dikt) -> 'Category':
|
||||
"""Returns the dict as a model
|
||||
|
||||
:param dikt: A dict.
|
||||
@@ -55,7 +55,7 @@ class Category(Model):
|
||||
|
||||
|
||||
:return: The id of this Category.
|
||||
:rtype: long
|
||||
:rtype: int
|
||||
"""
|
||||
return self._id
|
||||
|
||||
@@ -65,7 +65,7 @@ class Category(Model):
|
||||
|
||||
|
||||
:param id: The id of this Category.
|
||||
:type id: long
|
||||
:type id: int
|
||||
"""
|
||||
|
||||
self._id = id
|
||||
|
||||
@@ -5,7 +5,7 @@ from datetime import date, datetime # noqa: F401
|
||||
|
||||
from typing import List, Dict # noqa: F401
|
||||
|
||||
from openapi_server.models.base_model_ import Model
|
||||
from openapi_server.models.base_model import Model
|
||||
from openapi_server import util
|
||||
|
||||
|
||||
@@ -19,9 +19,9 @@ class Order(Model):
|
||||
"""Order - a model defined in OpenAPI
|
||||
|
||||
:param id: The id of this Order. # noqa: E501
|
||||
:type id: long
|
||||
:type id: int
|
||||
:param pet_id: The pet_id of this Order. # noqa: E501
|
||||
:type pet_id: long
|
||||
:type pet_id: int
|
||||
:param quantity: The quantity of this Order. # noqa: E501
|
||||
:type quantity: int
|
||||
:param ship_date: The ship_date of this Order. # noqa: E501
|
||||
@@ -32,8 +32,8 @@ class Order(Model):
|
||||
:type complete: bool
|
||||
"""
|
||||
self.openapi_types = {
|
||||
'id': long,
|
||||
'pet_id': long,
|
||||
'id': int,
|
||||
'pet_id': int,
|
||||
'quantity': int,
|
||||
'ship_date': datetime,
|
||||
'status': str,
|
||||
@@ -57,7 +57,7 @@ class Order(Model):
|
||||
self._complete = complete
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, dikt):
|
||||
def from_dict(cls, dikt) -> 'Order':
|
||||
"""Returns the dict as a model
|
||||
|
||||
:param dikt: A dict.
|
||||
@@ -73,7 +73,7 @@ class Order(Model):
|
||||
|
||||
|
||||
:return: The id of this Order.
|
||||
:rtype: long
|
||||
:rtype: int
|
||||
"""
|
||||
return self._id
|
||||
|
||||
@@ -83,7 +83,7 @@ class Order(Model):
|
||||
|
||||
|
||||
:param id: The id of this Order.
|
||||
:type id: long
|
||||
:type id: int
|
||||
"""
|
||||
|
||||
self._id = id
|
||||
@@ -94,7 +94,7 @@ class Order(Model):
|
||||
|
||||
|
||||
:return: The pet_id of this Order.
|
||||
:rtype: long
|
||||
:rtype: int
|
||||
"""
|
||||
return self._pet_id
|
||||
|
||||
@@ -104,7 +104,7 @@ class Order(Model):
|
||||
|
||||
|
||||
:param pet_id: The pet_id of this Order.
|
||||
:type pet_id: long
|
||||
:type pet_id: int
|
||||
"""
|
||||
|
||||
self._pet_id = pet_id
|
||||
|
||||
@@ -5,7 +5,7 @@ from datetime import date, datetime # noqa: F401
|
||||
|
||||
from typing import List, Dict # noqa: F401
|
||||
|
||||
from openapi_server.models.base_model_ import Model
|
||||
from openapi_server.models.base_model import Model
|
||||
from openapi_server.models.category import Category
|
||||
from openapi_server.models.tag import Tag
|
||||
from openapi_server import util
|
||||
@@ -23,7 +23,7 @@ class Pet(Model):
|
||||
"""Pet - a model defined in OpenAPI
|
||||
|
||||
:param id: The id of this Pet. # noqa: E501
|
||||
:type id: long
|
||||
:type id: int
|
||||
:param category: The category of this Pet. # noqa: E501
|
||||
:type category: Category
|
||||
:param name: The name of this Pet. # noqa: E501
|
||||
@@ -36,7 +36,7 @@ class Pet(Model):
|
||||
:type status: str
|
||||
"""
|
||||
self.openapi_types = {
|
||||
'id': long,
|
||||
'id': int,
|
||||
'category': Category,
|
||||
'name': str,
|
||||
'photo_urls': List[str],
|
||||
@@ -61,7 +61,7 @@ class Pet(Model):
|
||||
self._status = status
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, dikt):
|
||||
def from_dict(cls, dikt) -> 'Pet':
|
||||
"""Returns the dict as a model
|
||||
|
||||
:param dikt: A dict.
|
||||
@@ -77,7 +77,7 @@ class Pet(Model):
|
||||
|
||||
|
||||
:return: The id of this Pet.
|
||||
:rtype: long
|
||||
:rtype: int
|
||||
"""
|
||||
return self._id
|
||||
|
||||
@@ -87,7 +87,7 @@ class Pet(Model):
|
||||
|
||||
|
||||
:param id: The id of this Pet.
|
||||
:type id: long
|
||||
:type id: int
|
||||
"""
|
||||
|
||||
self._id = id
|
||||
|
||||
@@ -5,7 +5,7 @@ from datetime import date, datetime # noqa: F401
|
||||
|
||||
from typing import List, Dict # noqa: F401
|
||||
|
||||
from openapi_server.models.base_model_ import Model
|
||||
from openapi_server.models.base_model import Model
|
||||
from openapi_server import util
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ class StatusEnum(Model):
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, dikt):
|
||||
def from_dict(cls, dikt) -> 'StatusEnum':
|
||||
"""Returns the dict as a model
|
||||
|
||||
:param dikt: A dict.
|
||||
|
||||
@@ -5,7 +5,7 @@ from datetime import date, datetime # noqa: F401
|
||||
|
||||
from typing import List, Dict # noqa: F401
|
||||
|
||||
from openapi_server.models.base_model_ import Model
|
||||
from openapi_server.models.base_model import Model
|
||||
from openapi_server import util
|
||||
|
||||
|
||||
@@ -19,12 +19,12 @@ class Tag(Model):
|
||||
"""Tag - a model defined in OpenAPI
|
||||
|
||||
:param id: The id of this Tag. # noqa: E501
|
||||
:type id: long
|
||||
:type id: int
|
||||
:param name: The name of this Tag. # noqa: E501
|
||||
:type name: str
|
||||
"""
|
||||
self.openapi_types = {
|
||||
'id': long,
|
||||
'id': int,
|
||||
'name': str
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ class Tag(Model):
|
||||
self._name = name
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, dikt):
|
||||
def from_dict(cls, dikt) -> 'Tag':
|
||||
"""Returns the dict as a model
|
||||
|
||||
:param dikt: A dict.
|
||||
@@ -53,7 +53,7 @@ class Tag(Model):
|
||||
|
||||
|
||||
:return: The id of this Tag.
|
||||
:rtype: long
|
||||
:rtype: int
|
||||
"""
|
||||
return self._id
|
||||
|
||||
@@ -63,7 +63,7 @@ class Tag(Model):
|
||||
|
||||
|
||||
:param id: The id of this Tag.
|
||||
:type id: long
|
||||
:type id: int
|
||||
"""
|
||||
|
||||
self._id = id
|
||||
|
||||
@@ -5,7 +5,7 @@ from datetime import date, datetime # noqa: F401
|
||||
|
||||
from typing import List, Dict # noqa: F401
|
||||
|
||||
from openapi_server.models.base_model_ import Model
|
||||
from openapi_server.models.base_model import Model
|
||||
from openapi_server import util
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ class User(Model):
|
||||
"""User - a model defined in OpenAPI
|
||||
|
||||
:param id: The id of this User. # noqa: E501
|
||||
:type id: long
|
||||
:type id: int
|
||||
:param username: The username of this User. # noqa: E501
|
||||
:type username: str
|
||||
:param first_name: The first_name of this User. # noqa: E501
|
||||
@@ -36,7 +36,7 @@ class User(Model):
|
||||
:type user_status: int
|
||||
"""
|
||||
self.openapi_types = {
|
||||
'id': long,
|
||||
'id': int,
|
||||
'username': str,
|
||||
'first_name': str,
|
||||
'last_name': str,
|
||||
@@ -67,7 +67,7 @@ class User(Model):
|
||||
self._user_status = user_status
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, dikt):
|
||||
def from_dict(cls, dikt) -> 'User':
|
||||
"""Returns the dict as a model
|
||||
|
||||
:param dikt: A dict.
|
||||
@@ -83,7 +83,7 @@ class User(Model):
|
||||
|
||||
|
||||
:return: The id of this User.
|
||||
:rtype: long
|
||||
:rtype: int
|
||||
"""
|
||||
return self._id
|
||||
|
||||
@@ -93,7 +93,7 @@ class User(Model):
|
||||
|
||||
|
||||
:param id: The id of this User.
|
||||
:type id: long
|
||||
:type id: int
|
||||
"""
|
||||
|
||||
self._id = id
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
openapi: 3.0.1
|
||||
info:
|
||||
description: This is a sample server Petstore server. For this sample, you can use
|
||||
the api key `special-key` to test the authorization filters.
|
||||
description: "This is a sample server Petstore server. For this sample, you can\
|
||||
\ use the api key `special-key` to test the authorization filters."
|
||||
license:
|
||||
name: Apache-2.0
|
||||
url: https://www.apache.org/licenses/LICENSE-2.0.html
|
||||
@@ -22,6 +22,7 @@ tags:
|
||||
paths:
|
||||
/pet:
|
||||
post:
|
||||
description: ""
|
||||
operationId: add_pet
|
||||
requestBody:
|
||||
$ref: '#/components/requestBodies/Pet'
|
||||
@@ -37,6 +38,7 @@ paths:
|
||||
- pet
|
||||
x-openapi-router-controller: openapi_server.controllers.pet_controller
|
||||
put:
|
||||
description: ""
|
||||
operationId: update_pet
|
||||
requestBody:
|
||||
$ref: '#/components/requestBodies/Pet'
|
||||
@@ -101,8 +103,8 @@ paths:
|
||||
/pet/findByTags:
|
||||
get:
|
||||
deprecated: true
|
||||
description: Multiple tags can be provided with comma separated strings. Use
|
||||
tag1, tag2, tag3 for testing.
|
||||
description: "Multiple tags can be provided with comma separated strings. Use\
|
||||
\ tag1, tag2, tag3 for testing."
|
||||
operationId: find_pets_by_tags
|
||||
parameters:
|
||||
- description: Tags to filter by
|
||||
@@ -140,6 +142,7 @@ paths:
|
||||
x-openapi-router-controller: openapi_server.controllers.pet_controller
|
||||
/pet/{petId}:
|
||||
delete:
|
||||
description: ""
|
||||
operationId: delete_pet
|
||||
parameters:
|
||||
- explode: false
|
||||
@@ -203,6 +206,7 @@ paths:
|
||||
- pet
|
||||
x-openapi-router-controller: openapi_server.controllers.pet_controller
|
||||
patch:
|
||||
description: ""
|
||||
operationId: update_pet_status_with_enum
|
||||
parameters:
|
||||
- description: ID of pet to return
|
||||
@@ -242,6 +246,7 @@ paths:
|
||||
- pet
|
||||
x-openapi-router-controller: openapi_server.controllers.pet_controller
|
||||
post:
|
||||
description: ""
|
||||
operationId: update_pet_with_form
|
||||
parameters:
|
||||
- description: ID of pet that needs to be updated
|
||||
@@ -268,6 +273,7 @@ paths:
|
||||
x-openapi-router-controller: openapi_server.controllers.pet_controller
|
||||
/pet/{petId}/uploadImage:
|
||||
post:
|
||||
description: ""
|
||||
operationId: upload_file
|
||||
parameters:
|
||||
- description: ID of pet to update
|
||||
@@ -318,6 +324,7 @@ paths:
|
||||
x-openapi-router-controller: openapi_server.controllers.store_controller
|
||||
/store/order:
|
||||
post:
|
||||
description: ""
|
||||
operationId: place_order
|
||||
requestBody:
|
||||
content:
|
||||
@@ -421,6 +428,7 @@ paths:
|
||||
x-openapi-router-controller: openapi_server.controllers.user_controller
|
||||
/user/createWithArray:
|
||||
post:
|
||||
description: ""
|
||||
operationId: create_users_with_array_input
|
||||
requestBody:
|
||||
$ref: '#/components/requestBodies/UserArray'
|
||||
@@ -435,6 +443,7 @@ paths:
|
||||
x-openapi-router-controller: openapi_server.controllers.user_controller
|
||||
/user/createWithList:
|
||||
post:
|
||||
description: ""
|
||||
operationId: create_users_with_list_input
|
||||
requestBody:
|
||||
$ref: '#/components/requestBodies/UserArray'
|
||||
@@ -449,6 +458,7 @@ paths:
|
||||
x-openapi-router-controller: openapi_server.controllers.user_controller
|
||||
/user/login:
|
||||
get:
|
||||
description: ""
|
||||
operationId: login_user
|
||||
parameters:
|
||||
- description: The user name for login
|
||||
@@ -457,7 +467,7 @@ paths:
|
||||
name: username
|
||||
required: true
|
||||
schema:
|
||||
pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$
|
||||
pattern: "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$"
|
||||
type: string
|
||||
style: form
|
||||
- description: The password for login in clear text
|
||||
@@ -509,6 +519,7 @@ paths:
|
||||
x-openapi-router-controller: openapi_server.controllers.user_controller
|
||||
/user/logout:
|
||||
get:
|
||||
description: ""
|
||||
operationId: logout_user
|
||||
responses:
|
||||
default:
|
||||
@@ -544,6 +555,7 @@ paths:
|
||||
- user
|
||||
x-openapi-router-controller: openapi_server.controllers.user_controller
|
||||
get:
|
||||
description: ""
|
||||
operationId: get_user_by_name
|
||||
parameters:
|
||||
- description: The name that needs to be fetched. Use user1 for testing.
|
||||
@@ -663,15 +675,19 @@ components:
|
||||
properties:
|
||||
id:
|
||||
format: int64
|
||||
title: id
|
||||
type: integer
|
||||
petId:
|
||||
format: int64
|
||||
title: petId
|
||||
type: integer
|
||||
quantity:
|
||||
format: int32
|
||||
title: quantity
|
||||
type: integer
|
||||
shipDate:
|
||||
format: date-time
|
||||
title: shipDate
|
||||
type: string
|
||||
status:
|
||||
description: Order Status
|
||||
@@ -679,9 +695,11 @@ components:
|
||||
- placed
|
||||
- approved
|
||||
- delivered
|
||||
title: status
|
||||
type: string
|
||||
complete:
|
||||
default: false
|
||||
title: complete
|
||||
type: boolean
|
||||
title: Pet Order
|
||||
type: object
|
||||
@@ -695,9 +713,11 @@ components:
|
||||
properties:
|
||||
id:
|
||||
format: int64
|
||||
title: id
|
||||
type: integer
|
||||
name:
|
||||
pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$
|
||||
pattern: "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$"
|
||||
title: name
|
||||
type: string
|
||||
title: Pet category
|
||||
type: object
|
||||
@@ -717,22 +737,30 @@ components:
|
||||
properties:
|
||||
id:
|
||||
format: int64
|
||||
title: id
|
||||
type: integer
|
||||
username:
|
||||
title: username
|
||||
type: string
|
||||
firstName:
|
||||
title: firstName
|
||||
type: string
|
||||
lastName:
|
||||
title: lastName
|
||||
type: string
|
||||
email:
|
||||
title: email
|
||||
type: string
|
||||
password:
|
||||
title: password
|
||||
type: string
|
||||
phone:
|
||||
title: phone
|
||||
type: string
|
||||
userStatus:
|
||||
description: User Status
|
||||
format: int32
|
||||
title: userStatus
|
||||
type: integer
|
||||
title: a User
|
||||
type: object
|
||||
@@ -746,8 +774,10 @@ components:
|
||||
properties:
|
||||
id:
|
||||
format: int64
|
||||
title: id
|
||||
type: integer
|
||||
name:
|
||||
title: name
|
||||
type: string
|
||||
title: Pet Tag
|
||||
type: object
|
||||
@@ -773,15 +803,18 @@ components:
|
||||
properties:
|
||||
id:
|
||||
format: int64
|
||||
title: id
|
||||
type: integer
|
||||
category:
|
||||
$ref: '#/components/schemas/Category'
|
||||
name:
|
||||
example: doggie
|
||||
title: name
|
||||
type: string
|
||||
photoUrls:
|
||||
items:
|
||||
type: string
|
||||
title: photoUrls
|
||||
type: array
|
||||
xml:
|
||||
name: photoUrl
|
||||
@@ -789,6 +822,7 @@ components:
|
||||
tags:
|
||||
items:
|
||||
$ref: '#/components/schemas/Tag'
|
||||
title: tags
|
||||
type: array
|
||||
xml:
|
||||
name: tag
|
||||
@@ -799,6 +833,7 @@ components:
|
||||
- available
|
||||
- pending
|
||||
- sold
|
||||
title: status
|
||||
type: string
|
||||
required:
|
||||
- name
|
||||
@@ -812,9 +847,11 @@ components:
|
||||
properties:
|
||||
name:
|
||||
description: Updated name of the pet
|
||||
title: name
|
||||
type: string
|
||||
status:
|
||||
description: Updated status of the pet
|
||||
title: status
|
||||
type: string
|
||||
required:
|
||||
- name
|
||||
@@ -826,10 +863,12 @@ components:
|
||||
properties:
|
||||
additionalMetadata:
|
||||
description: Additional data to pass to server
|
||||
title: additionalMetadata
|
||||
type: string
|
||||
file:
|
||||
description: file to upload
|
||||
format: binary
|
||||
title: file
|
||||
type: string
|
||||
required:
|
||||
- file
|
||||
@@ -844,10 +883,13 @@ components:
|
||||
properties:
|
||||
code:
|
||||
format: int32
|
||||
title: code
|
||||
type: integer
|
||||
type:
|
||||
title: type
|
||||
type: string
|
||||
message:
|
||||
title: message
|
||||
type: string
|
||||
title: An uploaded response
|
||||
type: object
|
||||
@@ -857,6 +899,7 @@ components:
|
||||
- available
|
||||
- pending
|
||||
- sold
|
||||
title: statusEnum
|
||||
type: string
|
||||
securitySchemes:
|
||||
petstore_auth:
|
||||
@@ -867,15 +910,15 @@ components:
|
||||
write:pets: modify pets in your account
|
||||
read:pets: read your pets
|
||||
type: oauth2
|
||||
x-tokenInfoFunc: openapi_server.controllers.security_controller_.info_from_petstore_auth
|
||||
x-scopeValidateFunc: openapi_server.controllers.security_controller_.validate_scope_petstore_auth
|
||||
x-tokenInfoFunc: openapi_server.controllers.security_controller.info_from_petstore_auth
|
||||
x-scopeValidateFunc: openapi_server.controllers.security_controller.validate_scope_petstore_auth
|
||||
api_key:
|
||||
in: header
|
||||
name: api_key
|
||||
type: apiKey
|
||||
x-apikeyInfoFunc: openapi_server.controllers.security_controller_.info_from_api_key
|
||||
x-apikeyInfoFunc: openapi_server.controllers.security_controller.info_from_api_key
|
||||
auth_cookie:
|
||||
in: cookie
|
||||
name: AUTH_KEY
|
||||
type: apiKey
|
||||
x-apikeyInfoFunc: openapi_server.controllers.security_controller_.info_from_auth_cookie
|
||||
x-apikeyInfoFunc: openapi_server.controllers.security_controller.info_from_auth_cookie
|
||||
|
||||
@@ -67,6 +67,9 @@ def deserialize_date(string):
|
||||
:return: date.
|
||||
:rtype: date
|
||||
"""
|
||||
if string is None:
|
||||
return None
|
||||
|
||||
try:
|
||||
from dateutil.parser import parse
|
||||
return parse(string).date()
|
||||
@@ -84,6 +87,9 @@ def deserialize_datetime(string):
|
||||
:return: datetime.
|
||||
:rtype: datetime
|
||||
"""
|
||||
if string is None:
|
||||
return None
|
||||
|
||||
try:
|
||||
from dateutil.parser import parse
|
||||
return parse(string)
|
||||
|
||||
Reference in New Issue
Block a user