zio-schema
zio-schema copied to clipboard
Check default value existence for transient fields in derive macro
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.