Skip to content
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

Closed
987Nabil opened this issue Jan 30, 2024 · 6 comments · Fixed by #708
Closed

Check default value existence for transient fields in derive macro #654

987Nabil opened this issue Jan 30, 2024 · 6 comments · Fixed by #708
Labels

Comments

@987Nabil
Copy link
Contributor

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.

@987Nabil 987Nabil added the enhancement New feature or request label Jan 30, 2024
@jdegoes
Copy link
Member

jdegoes commented Jun 8, 2024

/bounty $75

Copy link

algora-pbc bot commented Jun 8, 2024

💎 $75 bounty • ZIO

Steps to solve:

  1. Start working: Comment /attempt #654 with your implementation plan
  2. Submit work: Create a pull request including /claim #654 in the PR body to claim the bounty
  3. Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts

Thank you for contributing to zio/zio-schema!

Add a bountyShare on socials

Attempt Started (GMT+0) Solution
🔴 @manishwin Jun 21, 2024, 6:39:56 AM WIP
🟢 @987Nabil #708

Copy link

algora-pbc bot commented Jun 28, 2024

@manishwin: Reminder that in 7 days the bounty will become up for grabs, so please submit a pull request before then 🙏

Copy link

algora-pbc bot commented Jun 30, 2024

💡 @987Nabil submitted a pull request that claims the bounty. You can visit your bounty board to reward.

Copy link

algora-pbc bot commented Jul 5, 2024

The bounty is up for grabs! Everyone is welcome to /attempt #654 🙌

Copy link

algora-pbc bot commented Jul 9, 2024

🎉🎈 @987Nabil has been awarded $75! 🎈🎊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants