-
Notifications
You must be signed in to change notification settings - Fork 47
enum validation #179
Comments
I think I know what is happening there: In [3]: @strawberry.enum
...: class Language(enum.Enum):
...: pal = "pal"
...: eng = "eng"
...: deu = "deu"
...: ita = "ita"
...: esp = "esp"
...: fra = "fra"
...:
In [4]: str(Language.deu)
Out[4]: 'Language.deu' You are using a In that specific case what you can do is use a In [9]: @strawberry.enum
...: class Language(enum.StrEnum):
...: pal = "pal"
...: eng = "eng"
...: deu = "deu"
...: ita = "ita"
...: esp = "esp"
...: fra = "fra"
...:
In [10]: str(Language.deu)
Out[10]: 'deu' For curiosity, is there any reason why you are not using |
Thanks for your prompt reply. I did update python to 3.11 and it works! That is an interesting question. Together with other colleagues we are working on a framework to be used primarily by linguists. We do know that we will be using ISO 639-3 codes. This is the reason for Thanks again for your help and great work with this library! |
Ah, just a FYI using |
Ok. Thanks for the information! |
First of all: thank you very much for this library! I have a question regarding how to properly validate an enum.
This is my model:
my enum:
and my type:
This is the query and the error that I see:
I do not want to use django_choices_field. How can I avoid then this validation error? Thanks!
The text was updated successfully, but these errors were encountered: