FastAPI code generator generating unhashable models when using an enum #11814
Answered
by
YuriiMotov
ChrisDAT20
asked this question in
Questions
-
First Check
Commit to Help
Example Code* In an OpenAPI schema definition file, I defined an enum type:
DraftType:
type: string
enum:
- Type1
- Type2
- Type3 which is generated to the following Python class:
It is used in another type:
The classes are then used in the FastAPI app:
However, the code raises an error when calling
|
Beta Was this translation helpful? Give feedback.
Answered by
YuriiMotov
Jul 9, 2024
Replies: 1 comment 6 replies
-
That's because you are using
To solve this you need to implement the Something like this (I haven't run the code below, it can contain mistakes):
|
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why don't you ask this question in the repo of
fast-code-generator
?I think it's closer to that project then to FastAPI itself..