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

Explicitly re-export types in models/__init__.py

Open johnthagen opened this issue 4 years ago • 0 comments

Describe the bug

In the generated client, the models/__init__.py looks something like:

""" Contains all the data models used in inputs/outputs """

from .type import Type

This makes it convenient to do:

from models import Type

But this is missing adding the types to __all__ to properly mark them as exported:

""" Contains all the data models used in inputs/outputs """

from .type import Type

__all__ = ["Type"]

Without this, mypy --strict throws the following errors:

error: Module "pcb_dr_api_client.models" does not explicitly export attribute "Type"; implicit reexport disabled

See: https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-no-implicit-reexport

Expected behavior

No errors in usage when mypy --strict is used for this kind of import.

Desktop (please complete the following information):

  • OS: macOS 10.15.7
  • Python Version: 3.9.8
  • openapi-python-client version: 0.10.7

johnthagen avatar Nov 22 '21 15:11 johnthagen