msgspec
msgspec copied to clipboard
Set field if not provided based on value of another field
Description
Last I checked, this library didn't have the ability to set the value of a field that was not passed in for deserialization based on the value of another field that has already been validated. This is the one reason I am using Pydantic right now. It would be great if this was possible.
Or maybe I missed this somewhere?
Oh, and the other thing is that the model is frozen
I think you can do this with a __post_init__ function
edit: link https://jcristharif.com/msgspec/structs.html#post-init-processing