-
Notifications
You must be signed in to change notification settings - Fork 22
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
Should make be non-final? #61
Comments
Firstly, thanks for the issue. I appreciate it! 🥰 I do aim to support evaluating as much as possible at compile-time. So if you're able to share any of your mega validation function, I could get to work patching up the holes—of course, I completely understand if you're unable to share that! I probably don't support the Java time constructs yet, so I'll add that ASAP. I'm actually considering extracting the compile-time evaluation code out into a separate library, so it could be used for other shenanigans.
Perhaps another approach would be adding an annotation (e.g.,
Ha! I didn't even consider that use case, but it's a great one. Ideally, this transformation should be possible at both compile time and run time. I could change the validate method to also allow for an It's already a bit unusual that the API involves a union type, and adding more options could make it even more confusing. Perhaps it could just be Ideally, we could keep the API minimal while supporting as many use cases as possible. Opting out of compile-time validation should be a relatively rare requirement, so perhaps adding an annotation for that might be best, as users would need to read the documentation to know it exists. If we allow the Anyhow! I hope that all makes sense 😄 Let me know what you think! |
I think I'm overcomplicating this w/ the whole Union type thing. It was probably too clever to begin with. What if The only downside is that it makes it slightly more awkward for the simple cases. Instead of |
Hey, thanks for the awesome lib!
I am in the process of migrating to it and have ran into a couple validations we have that can't be checked at compiletime (pretty nasty ones as in 100+ lines of code).
Rather than trying to chase macro issues I figured that I would just like to have an escape hatch to say "ok this thing wont work with just providing compiletime strings, but you still get all the nice decoder/encoders automatically having made sure they are validated at runtime"
For a simple example of something that does not work:
What I did locally for now was to fork and publish locally a version where the
make
function is not final. That allowed me to produce this insteadbut now I can still use it by
PastYear.make(2023)
and handle the errorThis would also allow make to change the input, for instance cleaning up a string:
Open for other suggestions on how this could be achieved :-)
The text was updated successfully, but these errors were encountered: