biome
biome copied to clipboard
📎 `derive(biome_deserialize::Deserializable)`: don't require the implementation of Default
Description
We currently require the implementation of Default
for any type that implements Deserializable
.
We should drop this requirement.
~This implies that we should require the presence of any field that is not wrapped in an Option
.
So, we could remove the required
field attribute.~
EDIT: I think it is not a good idea of requiring by default a field. biome_deserialize
is used for deserializing config files where most of the fields are expected to be optional.
Thus, requiring a field by default seems not a good change because it could incur adding many annotations.
However, I still think we should drop the requirement of implementing Default
.
Instead of calling Default::default()
on the deserialized struct, we could call the Default::default()
implementation of missing fields.
This moves the requirement of the struct to its optional fields.
Extra proposal
I am not sure if we need the next one. This could be left for the future.
We could add the support for ~the default struct attribute and~ the default field attribute to make a non-Option-wrapped field optional.