Skip to content

Commit 8476fe3

Browse files
committed
Always generate enuma with sorted members
1 parent f741d81 commit 8476fe3

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

end_to_end_tests/golden-record/my_test_api_client/models/an_all_of_enum.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33

44
class AnAllOfEnum(str, Enum):
5-
FOO = "foo"
6-
BAR = "bar"
75
A_DEFAULT = "a_default"
6+
BAR = "bar"
7+
FOO = "foo"
88
OVERRIDDEN_DEFAULT = "overridden_default"
99

1010
def __str__(self) -> str:

end_to_end_tests/golden-record/my_test_api_client/models/get_location_header_types_string_enum_header.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
class GetLocationHeaderTypesStringEnumHeader(str, Enum):
55
ONE = "one"
6-
TWO = "two"
76
THREE = "three"
7+
TWO = "two"
88

99
def __str__(self) -> str:
1010
return str(self.value)

openapi_python_client/templates/str_enum.py.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from enum import Enum
22

33
class {{ enum.class_info.name }}(str, Enum):
4-
{% for key, value in enum.values.items() %}
4+
{% for key, value in enum.values|dictsort(true) %}
55
{{ key }} = "{{ value }}"
66
{% endfor %}
77

0 commit comments

Comments
 (0)