Open
Description
Today, string enums are typed using Literal
to allow specific values and None
if the value is not set, which is OK. However, we also use str
as an option, which allows any value and defeats the purpose of having types in the first place.
For example, see wait_for
in https://elasticsearch-py.readthedocs.io/en/v8.13.1/api/ml.html#elasticsearch.client.MlClient.start_trained_model_deployment. The type is Literal['fully_allocated', 'started', 'starting'] | str | None
which prevents any useful type checking. We should remove the str
type.
Note that this is different from #1691 which is about using Python classes for enums.