Replies: 1 comment
-
Hi @phinate |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi @phinate |
Beta Was this translation helpful? Give feedback.
-
Hi! I have some funny behaviour where the type of a field in my pydantic model can change during runtime. My solution to that is to provide a custom json encoder that saves the field in a more efficient way outside of the json, then writes the path of that file out.
My problem with this is that I can't rely on the type annotation I provide for my field to be accurate at runtime, so I still get errors about non-serializable objects since the pydantic way to encode is using the type anno as the key in a dict.
Is there a way around this that doesn't involve doing weird things like subclassing
json()
?Any
doesn't seem to work.Beta Was this translation helpful? Give feedback.
All reactions