Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[python-experimental] fixes delete endpoint with no body use case (#1…
…2287) * Generates delete_coffee endpoint * Adds test of delete_coffee * Removes .run files * Fixes bug and adds test * Reverts version file * Reverts function sig * Removes comma
- Loading branch information
Showing
8 changed files
with
372 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
180 changes: 180 additions & 0 deletions
180
.../client/petstore/python-experimental/petstore_api/api/fake_api_endpoints/delete_coffee.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,180 @@ | ||
# coding: utf-8 | ||
|
||
""" | ||
Generated by: https://openapi-generator.tech | ||
""" | ||
|
||
from dataclasses import dataclass | ||
import re # noqa: F401 | ||
import sys # noqa: F401 | ||
import typing | ||
import urllib3 | ||
import functools # noqa: F401 | ||
|
||
from petstore_api import api_client, exceptions | ||
import decimal # noqa: F401 | ||
from datetime import date, datetime # noqa: F401 | ||
from frozendict import frozendict # noqa: F401 | ||
|
||
from petstore_api.schemas import ( # noqa: F401 | ||
AnyTypeSchema, | ||
ComposedSchema, | ||
DictSchema, | ||
ListSchema, | ||
StrSchema, | ||
IntSchema, | ||
Int32Schema, | ||
Int64Schema, | ||
Float32Schema, | ||
Float64Schema, | ||
NumberSchema, | ||
UUIDSchema, | ||
DateSchema, | ||
DateTimeSchema, | ||
DecimalSchema, | ||
BoolSchema, | ||
BinarySchema, | ||
NoneSchema, | ||
none_type, | ||
Configuration, | ||
Unset, | ||
unset, | ||
ComposedBase, | ||
ListBase, | ||
DictBase, | ||
NoneBase, | ||
StrBase, | ||
IntBase, | ||
Int32Base, | ||
Int64Base, | ||
Float32Base, | ||
Float64Base, | ||
NumberBase, | ||
UUIDBase, | ||
DateBase, | ||
DateTimeBase, | ||
BoolBase, | ||
BinaryBase, | ||
Schema, | ||
_SchemaValidator, | ||
_SchemaTypeChecker, | ||
_SchemaEnumMaker | ||
) | ||
|
||
# path params | ||
IdSchema = StrSchema | ||
RequestRequiredPathParams = typing.TypedDict( | ||
'RequestRequiredPathParams', | ||
{ | ||
'id': IdSchema, | ||
} | ||
) | ||
RequestOptionalPathParams = typing.TypedDict( | ||
'RequestOptionalPathParams', | ||
{ | ||
}, | ||
total=False | ||
) | ||
|
||
|
||
class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): | ||
pass | ||
|
||
|
||
request_path_id = api_client.PathParameter( | ||
name="id", | ||
style=api_client.ParameterStyle.SIMPLE, | ||
schema=IdSchema, | ||
required=True, | ||
) | ||
_path = '/fake/deleteCoffee/{id}' | ||
_method = 'DELETE' | ||
|
||
|
||
@dataclass | ||
class ApiResponseFor200(api_client.ApiResponse): | ||
response: urllib3.HTTPResponse | ||
body: Unset = unset | ||
headers: Unset = unset | ||
|
||
|
||
_response_for_200 = api_client.OpenApiResponse( | ||
response_cls=ApiResponseFor200, | ||
) | ||
|
||
|
||
@dataclass | ||
class ApiResponseForDefault(api_client.ApiResponse): | ||
response: urllib3.HTTPResponse | ||
body: Unset = unset | ||
headers: Unset = unset | ||
|
||
|
||
_response_for_default = api_client.OpenApiResponse( | ||
response_cls=ApiResponseForDefault, | ||
) | ||
_status_code_to_response = { | ||
'200': _response_for_200, | ||
'default': _response_for_default, | ||
} | ||
|
||
|
||
class DeleteCoffee(api_client.Api): | ||
|
||
def delete_coffee( | ||
self: api_client.Api, | ||
path_params: RequestPathParams = frozendict(), | ||
stream: bool = False, | ||
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, | ||
skip_deserialization: bool = False, | ||
) -> typing.Union[ | ||
ApiResponseFor200, | ||
ApiResponseForDefault, | ||
api_client.ApiResponseWithoutDeserialization | ||
]: | ||
""" | ||
Delete coffee | ||
:param skip_deserialization: If true then api_response.response will be set but | ||
api_response.body and api_response.headers will not be deserialized into schema | ||
class instances | ||
""" | ||
self._verify_typed_dict_inputs(RequestPathParams, path_params) | ||
|
||
_path_params = {} | ||
for parameter in ( | ||
request_path_id, | ||
): | ||
parameter_data = path_params.get(parameter.name, unset) | ||
if parameter_data is unset: | ||
continue | ||
serialized_data = parameter.serialize(parameter_data) | ||
_path_params.update(serialized_data) | ||
# TODO add cookie handling | ||
|
||
response = self.api_client.call_api( | ||
resource_path=_path, | ||
method=_method, | ||
path_params=_path_params, | ||
stream=stream, | ||
timeout=timeout, | ||
) | ||
|
||
if skip_deserialization: | ||
api_response = api_client.ApiResponseWithoutDeserialization(response=response) | ||
else: | ||
response_for_status = _status_code_to_response.get(str(response.status)) | ||
if response_for_status: | ||
api_response = response_for_status.deserialize(response, self.api_client.configuration) | ||
else: | ||
default_response = _status_code_to_response.get('default') | ||
if default_response: | ||
api_response = default_response.deserialize(response, self.api_client.configuration) | ||
else: | ||
api_response = api_client.ApiResponseWithoutDeserialization(response=response) | ||
|
||
if not 200 <= response.status <= 299: | ||
raise exceptions.ApiException(api_response=api_response) | ||
|
||
return api_response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.