openapi-python-client icon indicating copy to clipboard operation
openapi-python-client copied to clipboard

Docstring generated for `sync` and `asyncio` have incorrect return type

Open m3brown opened this issue 3 years ago • 0 comments

Describe the bug The sync_detailed and asyncio_detailed functions return type Response[...]

The non-detailed sync and asyncio functions return Response.parsed

The docstrings do not reflect this, though, because Response[...] is hard coded into the template used for generating the docstring for both functions.

This results in generated code where the type hint return type (Optional) is the not same as the docstring return type (Response)

def sync(
    account_id: str,
    *,
    client: AuthenticatedClient,
) -> Optional[Union[Any, ProblemDetails, UserDto]]:
    """Lookup user by accountId. (Auth policies: user)
    Args:
        account_id (str):
    Returns:
        Response[Union[Any, ProblemDetails, UserDto]]
    """

    return sync_detailed(
        account_id=account_id,
        client=client,
    ).parsed

To Reproduce TODO

Expected behavior The doctstring return type is identical to the type hint

OpenAPI Spec File TODO

Desktop (please complete the following information):

  • OS: Mac OS 12.3.1
  • Python Version: 3.9.11
  • openapi-python-client version: 0.11.1

Additional context Add any other context about the problem here.

m3brown avatar May 19 '22 21:05 m3brown