-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check default value existence for transient fields in derive macro #654
Comments
/bounty $75 |
💎 $75 bounty • ZIOSteps to solve:
Thank you for contributing to zio/zio-schema! Add a bounty • Share on socials
|
@manishwin: Reminder that in 7 days the bounty will become up for grabs, so please submit a pull request before then 🙏 |
💡 @987Nabil submitted a pull request that claims the bounty. You can visit your bounty board to reward. |
The bounty is up for grabs! Everyone is welcome to |
🎉🎈 @987Nabil has been awarded $75! 🎈🎊 |
Since schemas only consider constructor arguments, every field that is marked as transient without having a default value is basically a bug, since codecs can't create these values.
The idea would be, to check in the derive macros if there is a default value (either via the schema for the field or the
fieldDefaultValue
annotation) and throw an error if there is none. This would make is user error compile time.The only use case I can think of that this might not be nice for are write only schemas that did not need a default value before, but would need one after this change. But I would consider this a good trade off.
The text was updated successfully, but these errors were encountered: