Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,20 @@ _all_accept_content_types = (

class BaseApi(api_client.Api):

@typing.overload
def _{{operationId}}_oapg(
{{> endpoint_args selfType="api_client.Api" }}
{{> endpoint_args isOverload=true skipDeserialization="False"}}

@typing.overload
def _{{operationId}}_oapg(
{{> endpoint_args isOverload=true skipDeserialization="True"}}

@typing.overload
def _{{operationId}}_oapg(
{{> endpoint_args isOverload=true skipDeserialization="null"}}

def _{{operationId}}_oapg(
{{> endpoint_args isOverload=false skipDeserialization="null"}}
"""
{{#if summary}}
{{summary}}
Expand Down Expand Up @@ -533,8 +545,20 @@ class BaseApi(api_client.Api):
class {{operationIdCamelCase}}(BaseApi):
# this class is used by api classes that refer to endpoints with operationId fn names

@typing.overload
def {{operationId}}(
{{> endpoint_args isOverload=true skipDeserialization="False"}}

@typing.overload
def {{operationId}}(
{{> endpoint_args isOverload=true skipDeserialization="True"}}

@typing.overload
def {{operationId}}(
{{> endpoint_args isOverload=true skipDeserialization="null"}}

def {{operationId}}(
{{> endpoint_args selfType="BaseApi" }}
{{> endpoint_args isOverload=false skipDeserialization="null"}}
return self._{{operationId}}_oapg(
{{> endpoint_args_passed }}
)
Expand All @@ -543,8 +567,20 @@ class {{operationIdCamelCase}}(BaseApi):
class ApiFor{{httpMethod}}(BaseApi):
# this class is used by api classes that refer to endpoints by path and http method names

@typing.overload
def {{httpMethod}}(
{{> endpoint_args isOverload=true skipDeserialization="False"}}

@typing.overload
def {{httpMethod}}(
{{> endpoint_args isOverload=true skipDeserialization="True"}}
Comment thread
spacether marked this conversation as resolved.

@typing.overload
def {{httpMethod}}(
{{> endpoint_args isOverload=true skipDeserialization="null"}}

def {{httpMethod}}(
{{> endpoint_args selfType="BaseApi" }}
{{> endpoint_args isOverload=false skipDeserialization="null"}}
return self._{{operationId}}_oapg(
{{> endpoint_args_passed }}
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,46 +1,77 @@
self: {{selfType}},
self,
{{#if bodyParam}}
{{#with bodyParam}}
body: typing.Union[{{#each content}}{{#with this.schema}}{{baseName}}, {{> model_templates/schema_python_types }}{{/with}}{{/each}}{{#unless required}}schemas.Unset] = schemas.unset{{else}}]{{/unless}},
{{/with}}
{{#with bodyParam}}
{{#if isOverload}}
body: typing.Union[{{#each content}}{{#with this.schema}}{{baseName}},{{> model_templates/schema_python_types }}{{/with}}{{/each}}{{#unless required}}schemas.Unset] = schemas.unset{{else}}]{{/unless}},
{{else}}
body{{#unless required}} = schemas.unset{{/unless}},
{{/if}}
{{/with}}
{{/if}}
{{#if queryParams}}
query_params: RequestQueryParams = frozendict.frozendict(),
query_params{{#if isOverload}}: RequestQueryParams{{/if}} = frozendict.frozendict(),
{{/if}}
{{#if headerParams}}
header_params: RequestHeaderParams = frozendict.frozendict(),
header_params{{#if isOverload}}: RequestHeaderParams{{/if}} = frozendict.frozendict(),
{{/if}}
{{#if pathParams}}
path_params: RequestPathParams = frozendict.frozendict(),
path_params{{#if isOverload}}: RequestPathParams{{/if}} = frozendict.frozendict(),
{{/if}}
{{#if cookieParams}}
cookie_params: RequestCookieParams = frozendict.frozendict(),
cookie_params{{#if isOverload}}: RequestCookieParams{{/if}} = frozendict.frozendict(),
{{/if}}
{{#with bodyParam}}
{{#each content}}
{{#if @first}}
content_type: str = '{{{@key}}}',
{{/if}}
{{/each}}
{{#each content}}
{{#if @first}}
content_type{{#if isOverload}}: str{{/if}} = '{{{@key}}}',
{{/if}}
{{/each}}
{{/with}}
{{#if produces}}
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
accept_content_types{{#if isOverload}}: typing.Tuple[str]{{/if}} = _all_accept_content_types,
{{/if}}
{{#if servers}}
host_index: typing.Optional[int] = None,
host_index{{#if isOverload}}: typing.Optional[int]{{/if}} = None,
{{/if}}
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
stream{{#if isOverload}}: bool{{/if}} = False,
timeout{{#if isOverload}}: typing.Optional[typing.Union[int, typing.Tuple]]{{/if}} = None,
{{#if isOverload}}
{{#eq skipDeserialization "True"}}
skip_deserialization: typing_extensions.Literal[True] = True,
{{/eq}}
{{#eq skipDeserialization "False"}}
skip_deserialization: typing_extensions.Literal[False] = False,
{{/eq}}
{{#eq skipDeserialization "null"}}
skip_deserialization: bool = False,
{{/eq}}
{{else}}
skip_deserialization = False,
{{/if}}
{{#eq skipDeserialization "True"}}
) -> api_client.ApiResponseWithoutDeserialization:
{{/eq}}
{{#eq skipDeserialization "False"}}
) -> typing.Union[{{#each responses}}{{#if isDefault}}ApiResponseForDefault,{{else}}{{#if is2xx}}ApiResponseFor{{code}},{{/if}}{{/if}}{{/each}}api_client.ApiResponse,]:
{{/eq}}
{{#eq skipDeserialization "null"}}
{{#if isOverload}}
) -> typing.Union[
{{#each responses}}
{{#if isDefault}}
{{#each responses}}
{{#if isDefault}}
ApiResponseForDefault,
{{else}}
{{#if is2xx}}
{{else}}
{{#if is2xx}}
ApiResponseFor{{code}},
{{/if}}
{{/if}}
{{/each}}
api_client.ApiResponseWithoutDeserialization
{{/if}}
{{/if}}
{{/each}}
api_client.ApiResponseWithoutDeserialization,
]:
{{else}}
):
{{/if}}
{{/eq}}
{{#if isOverload}}
...
{{/if}}
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,50 @@ class ApiResponseFor200(api_client.ApiResponse):

class BaseApi(api_client.Api):

@typing.overload
def _post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg(
self: api_client.Api,
body: typing.Union[SchemaForRequestBodyApplicationJson, ],
self,
body: typing.Union[SchemaForRequestBodyApplicationJson,],
content_type: str = 'application/json',
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: typing_extensions.Literal[False] = False,
) -> typing.Union[ApiResponseFor200,api_client.ApiResponse,]:
...

@typing.overload
def _post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg(
self,
body: typing.Union[SchemaForRequestBodyApplicationJson,],
content_type: str = 'application/json',
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: typing_extensions.Literal[True] = True,
) -> api_client.ApiResponseWithoutDeserialization:
...

@typing.overload
def _post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg(
self,
body: typing.Union[SchemaForRequestBodyApplicationJson,],
content_type: str = 'application/json',
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: bool = False,
) -> typing.Union[
ApiResponseFor200,
api_client.ApiResponseWithoutDeserialization
api_client.ApiResponseWithoutDeserialization,
]:
...

def _post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg(
self,
body,
content_type = 'application/json',
stream = False,
timeout = None,
skip_deserialization = False,
Comment thread
EltonChou marked this conversation as resolved.
Outdated
):
"""
: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
Expand Down Expand Up @@ -119,17 +152,50 @@ class instances
class PostAdditionalpropertiesAllowsASchemaWhichShouldValidateRequestBody(BaseApi):
# this class is used by api classes that refer to endpoints with operationId fn names

@typing.overload
def post_additionalproperties_allows_a_schema_which_should_validate_request_body(
self,
body: typing.Union[SchemaForRequestBodyApplicationJson,],
content_type: str = 'application/json',
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: typing_extensions.Literal[False] = False,
) -> typing.Union[ApiResponseFor200,api_client.ApiResponse,]:
...

@typing.overload
def post_additionalproperties_allows_a_schema_which_should_validate_request_body(
self,
body: typing.Union[SchemaForRequestBodyApplicationJson,],
content_type: str = 'application/json',
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: typing_extensions.Literal[True] = True,
) -> api_client.ApiResponseWithoutDeserialization:
...

@typing.overload
def post_additionalproperties_allows_a_schema_which_should_validate_request_body(
self: BaseApi,
body: typing.Union[SchemaForRequestBodyApplicationJson, ],
self,
body: typing.Union[SchemaForRequestBodyApplicationJson,],
content_type: str = 'application/json',
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: bool = False,
) -> typing.Union[
ApiResponseFor200,
api_client.ApiResponseWithoutDeserialization
api_client.ApiResponseWithoutDeserialization,
]:
...

def post_additionalproperties_allows_a_schema_which_should_validate_request_body(
self,
body,
content_type = 'application/json',
stream = False,
timeout = None,
skip_deserialization = False,
):
return self._post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg(
body=body,
content_type=content_type,
Expand All @@ -142,17 +208,50 @@ def post_additionalproperties_allows_a_schema_which_should_validate_request_body
class ApiForpost(BaseApi):
# this class is used by api classes that refer to endpoints by path and http method names

@typing.overload
def post(
self,
body: typing.Union[SchemaForRequestBodyApplicationJson,],
content_type: str = 'application/json',
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: typing_extensions.Literal[False] = False,
) -> typing.Union[ApiResponseFor200,api_client.ApiResponse,]:
...

@typing.overload
def post(
self: BaseApi,
body: typing.Union[SchemaForRequestBodyApplicationJson, ],
self,
body: typing.Union[SchemaForRequestBodyApplicationJson,],
content_type: str = 'application/json',
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: typing_extensions.Literal[True] = True,
) -> api_client.ApiResponseWithoutDeserialization:
...

@typing.overload
def post(
self,
body: typing.Union[SchemaForRequestBodyApplicationJson,],
content_type: str = 'application/json',
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: bool = False,
) -> typing.Union[
ApiResponseFor200,
api_client.ApiResponseWithoutDeserialization
api_client.ApiResponseWithoutDeserialization,
]:
...

def post(
self,
body,
content_type = 'application/json',
stream = False,
timeout = None,
skip_deserialization = False,
):
return self._post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg(
body=body,
content_type=content_type,
Expand Down
Loading