Skip to content

API modules always return Optional[T] even if OpenAPI Schema always returns T #1062

Description

@linde12

I'm using client combined with raise_on_unexpected_status so i would like the API functions (sync & asyncio) to return T instead of Optional[T]

I know raise_on_unexpected_status is a runtime flag right now, but to me it makes more sense to have it as a build/generation time flag. The workaround is disabling linting or using cast everywhere, but it quickly gets tedious and very ugly.

See https://github.com/openapi-generators/openapi-python-client/blob/main/openapi_python_client/templates/endpoint_module.py.jinja#L71

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions