Skip to content

feat!: Prefer title attributes when naming Python parameters/properties. #606

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import types

from . import get_common_parameters, post_common_parameters
from . import get_common_parameters, get_naming_properties, post_common_parameters


class DefaultEndpoints:
Expand All @@ -13,3 +13,7 @@ def get_common_parameters(cls) -> types.ModuleType:
@classmethod
def post_common_parameters(cls) -> types.ModuleType:
return post_common_parameters

@classmethod
def get_naming_properties(cls) -> types.ModuleType:
return get_naming_properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
from typing import Any, Dict, Optional

import httpx

from ...client import Client
from ...models.get_naming_properties_response_200 import GetNamingPropertiesResponse200
from ...types import Response


def _get_kwargs(
*,
client: Client,
) -> Dict[str, Any]:
url = "{}/naming/properties".format(client.base_url)

headers: Dict[str, str] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()

return {
"method": "get",
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
}


def _parse_response(*, response: httpx.Response) -> Optional[GetNamingPropertiesResponse200]:
if response.status_code == 200:
response_200 = GetNamingPropertiesResponse200.from_dict(response.json())

return response_200
return None


def _build_response(*, response: httpx.Response) -> Response[GetNamingPropertiesResponse200]:
return Response(
status_code=response.status_code,
content=response.content,
headers=response.headers,
parsed=_parse_response(response=response),
)


def sync_detailed(
*,
client: Client,
) -> Response[GetNamingPropertiesResponse200]:
"""
Returns:
Response[GetNamingPropertiesResponse200]
"""

kwargs = _get_kwargs(
client=client,
)

response = httpx.request(
verify=client.verify_ssl,
**kwargs,
)

return _build_response(response=response)


def sync(
*,
client: Client,
) -> Optional[GetNamingPropertiesResponse200]:
"""
Returns:
Response[GetNamingPropertiesResponse200]
"""

return sync_detailed(
client=client,
).parsed


async def asyncio_detailed(
*,
client: Client,
) -> Response[GetNamingPropertiesResponse200]:
"""
Returns:
Response[GetNamingPropertiesResponse200]
"""

kwargs = _get_kwargs(
client=client,
)

async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.request(**kwargs)

return _build_response(response=response)


async def asyncio(
*,
client: Client,
) -> Optional[GetNamingPropertiesResponse200]:
"""
Returns:
Response[GetNamingPropertiesResponse200]
"""

return (
await asyncio_detailed(
client=client,
)
).parsed
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ def _get_kwargs(

def _parse_response(*, response: httpx.Response) -> Optional[List[bool]]:
if response.status_code == 200:
response_200 = cast(List[bool], response.json())
response_get_basic_list_of_booleans_tests_basic_lists_booleans_get = cast(List[bool], response.json())

return response_200
return response_get_basic_list_of_booleans_tests_basic_lists_booleans_get
return None


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ def _get_kwargs(

def _parse_response(*, response: httpx.Response) -> Optional[List[float]]:
if response.status_code == 200:
response_200 = cast(List[float], response.json())
response_get_basic_list_of_floats_tests_basic_lists_floats_get = cast(List[float], response.json())

return response_200
return response_get_basic_list_of_floats_tests_basic_lists_floats_get
return None


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ def _get_kwargs(

def _parse_response(*, response: httpx.Response) -> Optional[List[int]]:
if response.status_code == 200:
response_200 = cast(List[int], response.json())
response_get_basic_list_of_integers_tests_basic_lists_integers_get = cast(List[int], response.json())

return response_200
return response_get_basic_list_of_integers_tests_basic_lists_integers_get
return None


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ def _get_kwargs(

def _parse_response(*, response: httpx.Response) -> Optional[List[str]]:
if response.status_code == 200:
response_200 = cast(List[str], response.json())
response_get_basic_list_of_strings_tests_basic_lists_strings_get = cast(List[str], response.json())

return response_200
return response_get_basic_list_of_strings_tests_basic_lists_strings_get
return None


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ def _get_kwargs(
*,
client: Client,
an_enum_value: List[AnEnum],
an_enum_value_with_null: List[Optional[AnEnumWithNull]],
an_enum_value_with_only_null: List[None],
an_enum_value_with_null_and_string_values: List[Optional[AnEnumWithNull]],
an_enum_value_with_only_null_values: List[None],
some_date: Union[datetime.date, datetime.datetime],
) -> Dict[str, Any]:
url = "{}/tests/".format(client.base_url)
Expand All @@ -33,19 +33,19 @@ def _get_kwargs(

params["an_enum_value"] = json_an_enum_value

json_an_enum_value_with_null = []
for an_enum_value_with_null_item_data in an_enum_value_with_null:
json_an_enum_value_with_null_and_string_values = []
for an_enum_value_with_null_item_data in an_enum_value_with_null_and_string_values:
an_enum_value_with_null_item = (
an_enum_value_with_null_item_data.value if an_enum_value_with_null_item_data else None
)

json_an_enum_value_with_null.append(an_enum_value_with_null_item)
json_an_enum_value_with_null_and_string_values.append(an_enum_value_with_null_item)

params["an_enum_value_with_null"] = json_an_enum_value_with_null
params["an_enum_value_with_null"] = json_an_enum_value_with_null_and_string_values

json_an_enum_value_with_only_null = an_enum_value_with_only_null
json_an_enum_value_with_only_null_values = an_enum_value_with_only_null_values

params["an_enum_value_with_only_null"] = json_an_enum_value_with_only_null
params["an_enum_value_with_only_null"] = json_an_enum_value_with_only_null_values

if isinstance(some_date, datetime.date):
json_some_date = some_date.isoformat()
Expand All @@ -68,14 +68,14 @@ def _get_kwargs(

def _parse_response(*, response: httpx.Response) -> Optional[Union[HTTPValidationError, List[AModel]]]:
if response.status_code == 200:
response_200 = []
_response_200 = response.json()
for response_200_item_data in _response_200:
response_get_list_tests_get = []
_response_get_list_tests_get = response.json()
for response_200_item_data in _response_get_list_tests_get:
response_200_item = AModel.from_dict(response_200_item_data)

response_200.append(response_200_item)
response_get_list_tests_get.append(response_200_item)

return response_200
return response_get_list_tests_get
if response.status_code == 422:
response_422 = HTTPValidationError.from_dict(response.json())

Expand All @@ -100,8 +100,8 @@ def sync_detailed(
*,
client: Client,
an_enum_value: List[AnEnum],
an_enum_value_with_null: List[Optional[AnEnumWithNull]],
an_enum_value_with_only_null: List[None],
an_enum_value_with_null_and_string_values: List[Optional[AnEnumWithNull]],
an_enum_value_with_only_null_values: List[None],
some_date: Union[datetime.date, datetime.datetime],
) -> Response[Union[HTTPValidationError, List[AModel]]]:
"""Get List
Expand All @@ -110,8 +110,8 @@ def sync_detailed(

Args:
an_enum_value (List[AnEnum]):
an_enum_value_with_null (List[Optional[AnEnumWithNull]]):
an_enum_value_with_only_null (List[None]):
an_enum_value_with_null_and_string_values (List[Optional[AnEnumWithNull]]):
an_enum_value_with_only_null_values (List[None]):
some_date (Union[datetime.date, datetime.datetime]):

Returns:
Expand All @@ -121,8 +121,8 @@ def sync_detailed(
kwargs = _get_kwargs(
client=client,
an_enum_value=an_enum_value,
an_enum_value_with_null=an_enum_value_with_null,
an_enum_value_with_only_null=an_enum_value_with_only_null,
an_enum_value_with_null_and_string_values=an_enum_value_with_null_and_string_values,
an_enum_value_with_only_null_values=an_enum_value_with_only_null_values,
some_date=some_date,
)

Expand All @@ -138,8 +138,8 @@ def sync(
*,
client: Client,
an_enum_value: List[AnEnum],
an_enum_value_with_null: List[Optional[AnEnumWithNull]],
an_enum_value_with_only_null: List[None],
an_enum_value_with_null_and_string_values: List[Optional[AnEnumWithNull]],
an_enum_value_with_only_null_values: List[None],
some_date: Union[datetime.date, datetime.datetime],
) -> Optional[Union[HTTPValidationError, List[AModel]]]:
"""Get List
Expand All @@ -148,8 +148,8 @@ def sync(

Args:
an_enum_value (List[AnEnum]):
an_enum_value_with_null (List[Optional[AnEnumWithNull]]):
an_enum_value_with_only_null (List[None]):
an_enum_value_with_null_and_string_values (List[Optional[AnEnumWithNull]]):
an_enum_value_with_only_null_values (List[None]):
some_date (Union[datetime.date, datetime.datetime]):

Returns:
Expand All @@ -159,8 +159,8 @@ def sync(
return sync_detailed(
client=client,
an_enum_value=an_enum_value,
an_enum_value_with_null=an_enum_value_with_null,
an_enum_value_with_only_null=an_enum_value_with_only_null,
an_enum_value_with_null_and_string_values=an_enum_value_with_null_and_string_values,
an_enum_value_with_only_null_values=an_enum_value_with_only_null_values,
some_date=some_date,
).parsed

Expand All @@ -169,8 +169,8 @@ async def asyncio_detailed(
*,
client: Client,
an_enum_value: List[AnEnum],
an_enum_value_with_null: List[Optional[AnEnumWithNull]],
an_enum_value_with_only_null: List[None],
an_enum_value_with_null_and_string_values: List[Optional[AnEnumWithNull]],
an_enum_value_with_only_null_values: List[None],
some_date: Union[datetime.date, datetime.datetime],
) -> Response[Union[HTTPValidationError, List[AModel]]]:
"""Get List
Expand All @@ -179,8 +179,8 @@ async def asyncio_detailed(

Args:
an_enum_value (List[AnEnum]):
an_enum_value_with_null (List[Optional[AnEnumWithNull]]):
an_enum_value_with_only_null (List[None]):
an_enum_value_with_null_and_string_values (List[Optional[AnEnumWithNull]]):
an_enum_value_with_only_null_values (List[None]):
some_date (Union[datetime.date, datetime.datetime]):

Returns:
Expand All @@ -190,8 +190,8 @@ async def asyncio_detailed(
kwargs = _get_kwargs(
client=client,
an_enum_value=an_enum_value,
an_enum_value_with_null=an_enum_value_with_null,
an_enum_value_with_only_null=an_enum_value_with_only_null,
an_enum_value_with_null_and_string_values=an_enum_value_with_null_and_string_values,
an_enum_value_with_only_null_values=an_enum_value_with_only_null_values,
some_date=some_date,
)

Expand All @@ -205,8 +205,8 @@ async def asyncio(
*,
client: Client,
an_enum_value: List[AnEnum],
an_enum_value_with_null: List[Optional[AnEnumWithNull]],
an_enum_value_with_only_null: List[None],
an_enum_value_with_null_and_string_values: List[Optional[AnEnumWithNull]],
an_enum_value_with_only_null_values: List[None],
some_date: Union[datetime.date, datetime.datetime],
) -> Optional[Union[HTTPValidationError, List[AModel]]]:
"""Get List
Expand All @@ -215,8 +215,8 @@ async def asyncio(

Args:
an_enum_value (List[AnEnum]):
an_enum_value_with_null (List[Optional[AnEnumWithNull]]):
an_enum_value_with_only_null (List[None]):
an_enum_value_with_null_and_string_values (List[Optional[AnEnumWithNull]]):
an_enum_value_with_only_null_values (List[None]):
some_date (Union[datetime.date, datetime.datetime]):

Returns:
Expand All @@ -227,8 +227,8 @@ async def asyncio(
await asyncio_detailed(
client=client,
an_enum_value=an_enum_value,
an_enum_value_with_null=an_enum_value_with_null,
an_enum_value_with_only_null=an_enum_value_with_only_null,
an_enum_value_with_null_and_string_values=an_enum_value_with_null_and_string_values,
an_enum_value_with_only_null_values=an_enum_value_with_only_null_values,
some_date=some_date,
)
).parsed
Loading