Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion openapi_python_client/parser/properties/enum_property.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def values_from_list(values: List[ValueType]) -> Dict[str, ValueType]:
else:
output[f"VALUE_{value}"] = value
continue
if value[0].isalpha():
if value and value[0].isalpha():
key = value.upper()
else:
key = f"VALUE_{i}"
Expand Down
3 changes: 2 additions & 1 deletion tests/test_parser/test_properties/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ def test_get_imports(self, mocker):
def test_values_from_list(self):
from openapi_python_client.parser.properties import EnumProperty

data = ["abc", "123", "a23", "1bc", 4, -3, "a Thing WIth spaces"]
data = ["abc", "123", "a23", "1bc", 4, -3, "a Thing WIth spaces", ""]

result = EnumProperty.values_from_list(data)

Expand All @@ -528,6 +528,7 @@ def test_values_from_list(self):
"VALUE_4": 4,
"VALUE_NEGATIVE_3": -3,
"A_THING_WITH_SPACES": "a Thing WIth spaces",
"VALUE_7": "",
}

def test_values_from_list_duplicate(self):
Expand Down