File "openapi_python_client/parser/properties/__init__.py", line 545, in build_schemas
schemas_or_err = update_schemas_with_data(name, data, schemas)
File "openapi_python_client/parser/properties/__init__.py", line 521, in update_schemas_with_data
prop, schemas = build_model_property(data=data, name=name, schemas=schemas, required=True, parent_name=None)
File "openapi_python_client/parser/properties/__init__.py", line 261, in build_model_property
prop, schemas = property_from_data(
File "openapi_python_client/parser/properties/__init__.py", line 509, in property_from_data
return _property_from_data(name=name, required=required, data=data, schemas=schemas, parent_name=parent_name)
File "openapi_python_client/parser/properties/__init__.py", line 453, in _property_from_data
return build_enum_property(
File "openapi_python_client/parser/properties/__init__.py", line 343, in build_enum_property
values = EnumProperty.values_from_list(enum)
File "openapi_python_client/parser/properties/enum_property.py", line 62, in values_from_list
if value[0].isalpha():
TypeError: 'NoneType' object is not subscriptable
While it doesn't seem like a very standard practice, I don't see anything in OpenAPI against it, and other code generators choose to support it (e.g. lukeautry/tsoa#468).
Ah, interesting bug. We do this to determine whether we should be making a str, Enum or an IntEnum in the generated code. Looks like we need a special case for the empty string included in there. Thanks for reporting!
Activity
dbanty commented on Mar 23, 2021
Ah, interesting bug. We do this to determine whether we should be making a str, Enum or an IntEnum in the generated code. Looks like we need a special case for the empty string included in there. Thanks for reporting!
fix: Support empty strings in enums (closes #357) (#358). Thanks @ramnes