mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-05-12 20:50:55 +00:00
Merge 4ba2b8026193d3ddb2b3c150a788903b8a8b2a4c into 2fb26c362ea6557c90353606ccdc3c446d6a8f35
This commit is contained in:
commit
ddfbd9d5e3
@ -68,7 +68,7 @@ async def {{operationId}}(
|
||||
{{#notes}}"""{{.}}"""
|
||||
{{/notes}}if not Base{{classname}}.subclasses:
|
||||
raise HTTPException(status_code=500, detail="Not implemented")
|
||||
return await Base{{classname}}.subclasses[0]().{{operationId}}({{#allParams}}{{>impl_argument}}{{^-last}}, {{/-last}}{{/allParams}})
|
||||
return await Base{{classname}}.subclasses[0]().{{operationId}}({{#allParams}}{{>impl_argument}}{{^-last}}, {{/-last}}{{/allParams}}{{#authMethods}}{{#hasParams}}, {{/hasParams}}{{#authMethods}}token_{{name}}=token_{{name}}{{^-last}}, {{/-last}}{{/authMethods}}{{/authMethods}})
|
||||
{{^-last}}
|
||||
|
||||
|
||||
|
@ -18,14 +18,13 @@ class Base{{classname}}:
|
||||
async def {{operationId}}(
|
||||
self,
|
||||
{{#allParams}}
|
||||
{{>impl_argument_definition}},
|
||||
{{/allParams}}
|
||||
{{>impl_argument_definition}}{{^-last}},{{/-last}}{{/allParams}}{{#authMethods}}{{#hasParams}},{{/hasParams}}{{#authMethods}}
|
||||
token_{{name}}: str{{^-last}},{{/-last}}{{/authMethods}}{{/authMethods}}
|
||||
) -> {{returnType}}{{^returnType}}None{{/returnType}}:
|
||||
{{#notes}}"""{{.}}"""
|
||||
...{{/notes}}{{^notes}}...{{/notes}}
|
||||
{{^-last}}
|
||||
|
||||
|
||||
{{/-last}}
|
||||
{{/operation}}
|
||||
{{/operations}}
|
||||
|
@ -15,8 +15,7 @@ class BaseFakeApi:
|
||||
BaseFakeApi.subclasses = BaseFakeApi.subclasses + (cls,)
|
||||
async def fake_query_param_default(
|
||||
self,
|
||||
has_default: Annotated[Optional[StrictStr], Field(description="has default value")],
|
||||
no_default: Annotated[Optional[StrictStr], Field(description="no default value")],
|
||||
has_default: Annotated[Optional[StrictStr], Field(description="has default value")], no_default: Annotated[Optional[StrictStr], Field(description="no default value")]
|
||||
) -> None:
|
||||
""""""
|
||||
...
|
||||
|
@ -56,7 +56,7 @@ async def add_pet(
|
||||
""""""
|
||||
if not BasePetApi.subclasses:
|
||||
raise HTTPException(status_code=500, detail="Not implemented")
|
||||
return await BasePetApi.subclasses[0]().add_pet(pet)
|
||||
return await BasePetApi.subclasses[0]().add_pet(pet, token_petstore_auth=token_petstore_auth)
|
||||
|
||||
|
||||
@router.delete(
|
||||
@ -78,7 +78,7 @@ async def delete_pet(
|
||||
""""""
|
||||
if not BasePetApi.subclasses:
|
||||
raise HTTPException(status_code=500, detail="Not implemented")
|
||||
return await BasePetApi.subclasses[0]().delete_pet(petId, api_key)
|
||||
return await BasePetApi.subclasses[0]().delete_pet(petId, api_key, token_petstore_auth=token_petstore_auth)
|
||||
|
||||
|
||||
@router.get(
|
||||
@ -100,7 +100,7 @@ async def find_pets_by_status(
|
||||
"""Multiple status values can be provided with comma separated strings"""
|
||||
if not BasePetApi.subclasses:
|
||||
raise HTTPException(status_code=500, detail="Not implemented")
|
||||
return await BasePetApi.subclasses[0]().find_pets_by_status(status)
|
||||
return await BasePetApi.subclasses[0]().find_pets_by_status(status, token_petstore_auth=token_petstore_auth)
|
||||
|
||||
|
||||
@router.get(
|
||||
@ -122,7 +122,7 @@ async def find_pets_by_tags(
|
||||
"""Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing."""
|
||||
if not BasePetApi.subclasses:
|
||||
raise HTTPException(status_code=500, detail="Not implemented")
|
||||
return await BasePetApi.subclasses[0]().find_pets_by_tags(tags)
|
||||
return await BasePetApi.subclasses[0]().find_pets_by_tags(tags, token_petstore_auth=token_petstore_auth)
|
||||
|
||||
|
||||
@router.get(
|
||||
@ -145,7 +145,7 @@ async def get_pet_by_id(
|
||||
"""Returns a single pet"""
|
||||
if not BasePetApi.subclasses:
|
||||
raise HTTPException(status_code=500, detail="Not implemented")
|
||||
return await BasePetApi.subclasses[0]().get_pet_by_id(petId)
|
||||
return await BasePetApi.subclasses[0]().get_pet_by_id(petId, token_api_key=token_api_key)
|
||||
|
||||
|
||||
@router.put(
|
||||
@ -169,7 +169,7 @@ async def update_pet(
|
||||
""""""
|
||||
if not BasePetApi.subclasses:
|
||||
raise HTTPException(status_code=500, detail="Not implemented")
|
||||
return await BasePetApi.subclasses[0]().update_pet(pet)
|
||||
return await BasePetApi.subclasses[0]().update_pet(pet, token_petstore_auth=token_petstore_auth)
|
||||
|
||||
|
||||
@router.post(
|
||||
@ -192,7 +192,7 @@ async def update_pet_with_form(
|
||||
""""""
|
||||
if not BasePetApi.subclasses:
|
||||
raise HTTPException(status_code=500, detail="Not implemented")
|
||||
return await BasePetApi.subclasses[0]().update_pet_with_form(petId, name, status)
|
||||
return await BasePetApi.subclasses[0]().update_pet_with_form(petId, name, status, token_petstore_auth=token_petstore_auth)
|
||||
|
||||
|
||||
@router.post(
|
||||
@ -215,4 +215,4 @@ async def upload_file(
|
||||
""""""
|
||||
if not BasePetApi.subclasses:
|
||||
raise HTTPException(status_code=500, detail="Not implemented")
|
||||
return await BasePetApi.subclasses[0]().upload_file(petId, additional_metadata, file)
|
||||
return await BasePetApi.subclasses[0]().upload_file(petId, additional_metadata, file, token_petstore_auth=token_petstore_auth)
|
||||
|
@ -18,6 +18,7 @@ class BasePetApi:
|
||||
async def add_pet(
|
||||
self,
|
||||
pet: Annotated[Pet, Field(description="Pet object that needs to be added to the store")],
|
||||
token_petstore_auth: str
|
||||
) -> Pet:
|
||||
""""""
|
||||
...
|
||||
@ -25,8 +26,8 @@ class BasePetApi:
|
||||
|
||||
async def delete_pet(
|
||||
self,
|
||||
petId: Annotated[StrictInt, Field(description="Pet id to delete")],
|
||||
api_key: Optional[StrictStr],
|
||||
petId: Annotated[StrictInt, Field(description="Pet id to delete")], api_key: Optional[StrictStr],
|
||||
token_petstore_auth: str
|
||||
) -> None:
|
||||
""""""
|
||||
...
|
||||
@ -35,6 +36,7 @@ class BasePetApi:
|
||||
async def find_pets_by_status(
|
||||
self,
|
||||
status: Annotated[List[StrictStr], Field(description="Status values that need to be considered for filter")],
|
||||
token_petstore_auth: str
|
||||
) -> List[Pet]:
|
||||
"""Multiple status values can be provided with comma separated strings"""
|
||||
...
|
||||
@ -43,6 +45,7 @@ class BasePetApi:
|
||||
async def find_pets_by_tags(
|
||||
self,
|
||||
tags: Annotated[List[StrictStr], Field(description="Tags to filter by")],
|
||||
token_petstore_auth: str
|
||||
) -> List[Pet]:
|
||||
"""Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing."""
|
||||
...
|
||||
@ -51,6 +54,7 @@ class BasePetApi:
|
||||
async def get_pet_by_id(
|
||||
self,
|
||||
petId: Annotated[StrictInt, Field(description="ID of pet to return")],
|
||||
token_api_key: str
|
||||
) -> Pet:
|
||||
"""Returns a single pet"""
|
||||
...
|
||||
@ -59,6 +63,7 @@ class BasePetApi:
|
||||
async def update_pet(
|
||||
self,
|
||||
pet: Annotated[Pet, Field(description="Pet object that needs to be added to the store")],
|
||||
token_petstore_auth: str
|
||||
) -> Pet:
|
||||
""""""
|
||||
...
|
||||
@ -66,9 +71,8 @@ class BasePetApi:
|
||||
|
||||
async def update_pet_with_form(
|
||||
self,
|
||||
petId: Annotated[StrictInt, Field(description="ID of pet that needs to be updated")],
|
||||
name: Annotated[Optional[StrictStr], Field(description="Updated name of the pet")],
|
||||
status: Annotated[Optional[StrictStr], Field(description="Updated status of the pet")],
|
||||
petId: Annotated[StrictInt, Field(description="ID of pet that needs to be updated")], name: Annotated[Optional[StrictStr], Field(description="Updated name of the pet")], status: Annotated[Optional[StrictStr], Field(description="Updated status of the pet")],
|
||||
token_petstore_auth: str
|
||||
) -> None:
|
||||
""""""
|
||||
...
|
||||
@ -76,9 +80,8 @@ class BasePetApi:
|
||||
|
||||
async def upload_file(
|
||||
self,
|
||||
petId: Annotated[StrictInt, Field(description="ID of pet to update")],
|
||||
additional_metadata: Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")],
|
||||
file: Annotated[Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]], Field(description="file to upload")],
|
||||
petId: Annotated[StrictInt, Field(description="ID of pet to update")], additional_metadata: Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")], file: Annotated[Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]], Field(description="file to upload")],
|
||||
token_petstore_auth: str
|
||||
) -> ApiResponse:
|
||||
""""""
|
||||
...
|
||||
|
@ -72,7 +72,7 @@ async def get_inventory(
|
||||
"""Returns a map of status codes to quantities"""
|
||||
if not BaseStoreApi.subclasses:
|
||||
raise HTTPException(status_code=500, detail="Not implemented")
|
||||
return await BaseStoreApi.subclasses[0]().get_inventory()
|
||||
return await BaseStoreApi.subclasses[0]().get_inventory(token_api_key=token_api_key)
|
||||
|
||||
|
||||
@router.get(
|
||||
|
@ -16,7 +16,7 @@ class BaseStoreApi:
|
||||
BaseStoreApi.subclasses = BaseStoreApi.subclasses + (cls,)
|
||||
async def delete_order(
|
||||
self,
|
||||
orderId: Annotated[StrictStr, Field(description="ID of the order that needs to be deleted")],
|
||||
orderId: Annotated[StrictStr, Field(description="ID of the order that needs to be deleted")]
|
||||
) -> None:
|
||||
"""For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors"""
|
||||
...
|
||||
@ -24,6 +24,8 @@ class BaseStoreApi:
|
||||
|
||||
async def get_inventory(
|
||||
self,
|
||||
|
||||
token_api_key: str
|
||||
) -> Dict[str, int]:
|
||||
"""Returns a map of status codes to quantities"""
|
||||
...
|
||||
@ -31,7 +33,7 @@ class BaseStoreApi:
|
||||
|
||||
async def get_order_by_id(
|
||||
self,
|
||||
orderId: Annotated[int, Field(le=5, strict=True, ge=1, description="ID of pet that needs to be fetched")],
|
||||
orderId: Annotated[int, Field(le=5, strict=True, ge=1, description="ID of pet that needs to be fetched")]
|
||||
) -> Order:
|
||||
"""For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions"""
|
||||
...
|
||||
@ -39,7 +41,7 @@ class BaseStoreApi:
|
||||
|
||||
async def place_order(
|
||||
self,
|
||||
order: Annotated[Order, Field(description="order placed for purchasing the pet")],
|
||||
order: Annotated[Order, Field(description="order placed for purchasing the pet")]
|
||||
) -> Order:
|
||||
""""""
|
||||
...
|
||||
|
@ -54,7 +54,7 @@ async def create_user(
|
||||
"""This can only be done by the logged in user."""
|
||||
if not BaseUserApi.subclasses:
|
||||
raise HTTPException(status_code=500, detail="Not implemented")
|
||||
return await BaseUserApi.subclasses[0]().create_user(user)
|
||||
return await BaseUserApi.subclasses[0]().create_user(user, token_api_key=token_api_key)
|
||||
|
||||
|
||||
@router.post(
|
||||
@ -75,7 +75,7 @@ async def create_users_with_array_input(
|
||||
""""""
|
||||
if not BaseUserApi.subclasses:
|
||||
raise HTTPException(status_code=500, detail="Not implemented")
|
||||
return await BaseUserApi.subclasses[0]().create_users_with_array_input(user)
|
||||
return await BaseUserApi.subclasses[0]().create_users_with_array_input(user, token_api_key=token_api_key)
|
||||
|
||||
|
||||
@router.post(
|
||||
@ -96,7 +96,7 @@ async def create_users_with_list_input(
|
||||
""""""
|
||||
if not BaseUserApi.subclasses:
|
||||
raise HTTPException(status_code=500, detail="Not implemented")
|
||||
return await BaseUserApi.subclasses[0]().create_users_with_list_input(user)
|
||||
return await BaseUserApi.subclasses[0]().create_users_with_list_input(user, token_api_key=token_api_key)
|
||||
|
||||
|
||||
@router.delete(
|
||||
@ -118,7 +118,7 @@ async def delete_user(
|
||||
"""This can only be done by the logged in user."""
|
||||
if not BaseUserApi.subclasses:
|
||||
raise HTTPException(status_code=500, detail="Not implemented")
|
||||
return await BaseUserApi.subclasses[0]().delete_user(username)
|
||||
return await BaseUserApi.subclasses[0]().delete_user(username, token_api_key=token_api_key)
|
||||
|
||||
|
||||
@router.get(
|
||||
@ -178,7 +178,7 @@ async def logout_user(
|
||||
""""""
|
||||
if not BaseUserApi.subclasses:
|
||||
raise HTTPException(status_code=500, detail="Not implemented")
|
||||
return await BaseUserApi.subclasses[0]().logout_user()
|
||||
return await BaseUserApi.subclasses[0]().logout_user(token_api_key=token_api_key)
|
||||
|
||||
|
||||
@router.put(
|
||||
@ -201,4 +201,4 @@ async def update_user(
|
||||
"""This can only be done by the logged in user."""
|
||||
if not BaseUserApi.subclasses:
|
||||
raise HTTPException(status_code=500, detail="Not implemented")
|
||||
return await BaseUserApi.subclasses[0]().update_user(username, user)
|
||||
return await BaseUserApi.subclasses[0]().update_user(username, user, token_api_key=token_api_key)
|
||||
|
@ -17,6 +17,7 @@ class BaseUserApi:
|
||||
async def create_user(
|
||||
self,
|
||||
user: Annotated[User, Field(description="Created user object")],
|
||||
token_api_key: str
|
||||
) -> None:
|
||||
"""This can only be done by the logged in user."""
|
||||
...
|
||||
@ -25,6 +26,7 @@ class BaseUserApi:
|
||||
async def create_users_with_array_input(
|
||||
self,
|
||||
user: Annotated[List[User], Field(description="List of user object")],
|
||||
token_api_key: str
|
||||
) -> None:
|
||||
""""""
|
||||
...
|
||||
@ -33,6 +35,7 @@ class BaseUserApi:
|
||||
async def create_users_with_list_input(
|
||||
self,
|
||||
user: Annotated[List[User], Field(description="List of user object")],
|
||||
token_api_key: str
|
||||
) -> None:
|
||||
""""""
|
||||
...
|
||||
@ -41,6 +44,7 @@ class BaseUserApi:
|
||||
async def delete_user(
|
||||
self,
|
||||
username: Annotated[StrictStr, Field(description="The name that needs to be deleted")],
|
||||
token_api_key: str
|
||||
) -> None:
|
||||
"""This can only be done by the logged in user."""
|
||||
...
|
||||
@ -48,7 +52,7 @@ class BaseUserApi:
|
||||
|
||||
async def get_user_by_name(
|
||||
self,
|
||||
username: Annotated[StrictStr, Field(description="The name that needs to be fetched. Use user1 for testing.")],
|
||||
username: Annotated[StrictStr, Field(description="The name that needs to be fetched. Use user1 for testing.")]
|
||||
) -> User:
|
||||
""""""
|
||||
...
|
||||
@ -56,8 +60,7 @@ class BaseUserApi:
|
||||
|
||||
async def login_user(
|
||||
self,
|
||||
username: Annotated[str, Field(strict=True, description="The user name for login")],
|
||||
password: Annotated[StrictStr, Field(description="The password for login in clear text")],
|
||||
username: Annotated[str, Field(strict=True, description="The user name for login")], password: Annotated[StrictStr, Field(description="The password for login in clear text")]
|
||||
) -> str:
|
||||
""""""
|
||||
...
|
||||
@ -65,6 +68,8 @@ class BaseUserApi:
|
||||
|
||||
async def logout_user(
|
||||
self,
|
||||
|
||||
token_api_key: str
|
||||
) -> None:
|
||||
""""""
|
||||
...
|
||||
@ -72,8 +77,8 @@ class BaseUserApi:
|
||||
|
||||
async def update_user(
|
||||
self,
|
||||
username: Annotated[StrictStr, Field(description="name that need to be deleted")],
|
||||
user: Annotated[User, Field(description="Updated user object")],
|
||||
username: Annotated[StrictStr, Field(description="name that need to be deleted")], user: Annotated[User, Field(description="Updated user object")],
|
||||
token_api_key: str
|
||||
) -> None:
|
||||
"""This can only be done by the logged in user."""
|
||||
...
|
||||
|
Loading…
x
Reference in New Issue
Block a user