diff --git a/end_to_end_tests/golden-record-custom/custom_e2e/models/an_enum.py b/end_to_end_tests/golden-record-custom/custom_e2e/models/an_enum.py index 9616ca82e..c266d0763 100644 --- a/end_to_end_tests/golden-record-custom/custom_e2e/models/an_enum.py +++ b/end_to_end_tests/golden-record-custom/custom_e2e/models/an_enum.py @@ -4,3 +4,6 @@ class AnEnum(str, Enum): FIRST_VALUE = "FIRST_VALUE" SECOND_VALUE = "SECOND_VALUE" + + def __str__(self) -> str: + return str(self.value) diff --git a/end_to_end_tests/golden-record-custom/custom_e2e/models/an_int_enum.py b/end_to_end_tests/golden-record-custom/custom_e2e/models/an_int_enum.py index 6048add0f..d7d7a713d 100644 --- a/end_to_end_tests/golden-record-custom/custom_e2e/models/an_int_enum.py +++ b/end_to_end_tests/golden-record-custom/custom_e2e/models/an_int_enum.py @@ -5,3 +5,6 @@ class AnIntEnum(IntEnum): VALUE_NEGATIVE_1 = -1 VALUE_1 = 1 VALUE_2 = 2 + + def __str__(self) -> str: + return str(self.value) diff --git a/end_to_end_tests/golden-record-custom/custom_e2e/models/different_enum.py b/end_to_end_tests/golden-record-custom/custom_e2e/models/different_enum.py index 00357ab7a..6c167f25c 100644 --- a/end_to_end_tests/golden-record-custom/custom_e2e/models/different_enum.py +++ b/end_to_end_tests/golden-record-custom/custom_e2e/models/different_enum.py @@ -4,3 +4,6 @@ class DifferentEnum(str, Enum): DIFFERENT = "DIFFERENT" OTHER = "OTHER" + + def __str__(self) -> str: + return str(self.value) diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/an_enum.py b/end_to_end_tests/golden-record/my_test_api_client/models/an_enum.py index 9616ca82e..c266d0763 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/an_enum.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/an_enum.py @@ -4,3 +4,6 @@ class AnEnum(str, Enum): FIRST_VALUE = "FIRST_VALUE" SECOND_VALUE = "SECOND_VALUE" + + def __str__(self) -> str: + return str(self.value) diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/an_int_enum.py b/end_to_end_tests/golden-record/my_test_api_client/models/an_int_enum.py index 6048add0f..d7d7a713d 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/an_int_enum.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/an_int_enum.py @@ -5,3 +5,6 @@ class AnIntEnum(IntEnum): VALUE_NEGATIVE_1 = -1 VALUE_1 = 1 VALUE_2 = 2 + + def __str__(self) -> str: + return str(self.value) diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/different_enum.py b/end_to_end_tests/golden-record/my_test_api_client/models/different_enum.py index 00357ab7a..6c167f25c 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/different_enum.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/different_enum.py @@ -4,3 +4,6 @@ class DifferentEnum(str, Enum): DIFFERENT = "DIFFERENT" OTHER = "OTHER" + + def __str__(self) -> str: + return str(self.value) diff --git a/openapi_python_client/templates/int_enum.pyi b/openapi_python_client/templates/int_enum.pyi index 7b8904e65..18d6066ae 100644 --- a/openapi_python_client/templates/int_enum.pyi +++ b/openapi_python_client/templates/int_enum.pyi @@ -4,3 +4,6 @@ class {{ enum.reference.class_name }}(IntEnum): {% for key, value in enum.values.items() %} {{ key }} = {{ value }} {% endfor %} + + def __str__(self) -> str: + return str(self.value) diff --git a/openapi_python_client/templates/str_enum.pyi b/openapi_python_client/templates/str_enum.pyi index 4c7f97f89..74dcd1de2 100644 --- a/openapi_python_client/templates/str_enum.pyi +++ b/openapi_python_client/templates/str_enum.pyi @@ -4,3 +4,6 @@ class {{ enum.reference.class_name }}(str, Enum): {% for key, value in enum.values.items() %} {{ key }} = "{{ value }}" {% endfor %} + + def __str__(self) -> str: + return str(self.value)