Describe the bug
When there is a charfield with choices, and blank=True, the empty string ('') is a valid value, unrelated to the field being required or not, or nullable or not.
However drf-spectacular creates an enum of the choices without an option for the empty string.
To Reproduce
django-oscar-api UserAddressSerializer, BillingAddressSerializer, ShippingAddressSerializer, all include a title that has a choices of Mr, Mrs, Dr, etc, and blank=True
Expected behavior
The enum needs to include the empty string, or some other schema structure that allows the empty string.
IMO it would be preferrable that the enum in components doesnt include the empty string, as this would mean two fields using the same choices but different blank values would require two enums. And having two enums would result in more clashes, component renames, and those enum names are now appearing in peoples ENUM_NAME_OVERRIDES .
Describe the bug
When there is a charfield with choices, and
blank=True, the empty string ('') is a valid value, unrelated to the field being required or not, or nullable or not.However drf-spectacular creates an enum of the choices without an option for the empty string.
To Reproduce
django-oscar-api UserAddressSerializer, BillingAddressSerializer, ShippingAddressSerializer, all include a
titlethat has a choices of Mr, Mrs, Dr, etc, andblank=TrueExpected behavior
The enum needs to include the empty string, or some other schema structure that allows the empty string.
IMO it would be preferrable that the enum in components doesnt include the empty string, as this would mean two fields using the same choices but different
blankvalues would require two enums. And having two enums would result in more clashes, component renames, and those enum names are now appearing in peoples ENUM_NAME_OVERRIDES .