Replies: 1 comment 1 reply
-
|
I guess we're talking about schemas like For users schema, it should be quite easy to enable it like this in your app: class UserRead(schemas.BaseUser[uuid.UUID]):
model_config = ConfigDict(frozen=True)Pydantic merges parent config, so you are also sure to keep the settings set by |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I think we should make all the Pydantic models that are used towards FastAPI response models
frozen. I ask for this feature primarily because I would like the static typechecker to stop me from mutating response models, and to make the response models hashable.I actually would benefit quite heavily from the hashability as I put some model instances into
setHashSet.An alternative solution is for me to make my own class implementations
frozen=True, this is currently impossible without pyright complaining (which is fine).Beta Was this translation helpful? Give feedback.
All reactions