-
Notifications
You must be signed in to change notification settings - Fork 162
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
added simpleEnum annotation #564
Conversation
@pablf so is the intention to automatically insert the |
You are right. In practice, JSONCodec always checked if it was a simple Enum, so it does not give any option. This is why I thought it was intended to be added automatically. Do I remove that part? |
And if we included an |
Now it should pass the tests. |
@pablf so I think the original intention of the issue was just to create a standard annotation for use by downstream libraries - we already have one for zio-dynamodb - but the the thought was to standardise it. The fact that the JSon codec already defaults to this behaviour probably means that there is no extra work required for derive gen macro - what do you think @jdegoes ? |
@googley42 That feature for the JSONCodec was done in #526. Maybe it would also be interesting for a Although with the last commit I did you could use
so if it is added automatically ( |
Ah yes - I get this now - this is great idea and will simplify the codecs of all downstream libs! The only thing I want to confirm is that will a manually created |
@googley42 Then great! Yes, that would be the expected behaviour. I have added the tests to ensure that it's like that in the future. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM and I think this a great piece of functionality - however I am not a zio-schema maintainer or have much knowledge around macros! you may want to get another review cc @zio/zio-schema
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
/claim #506
Throws exception if used where not applicable and it is added automatically if it is indeed a simple Enum.