You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Currently, the IDeserializer.Deserialize<T> methods return null if the parsed string is empty (or whitespaces). However, because the interface description declares the return type as T and not T? it is not immediately obvious that null can even be a valid return value.
Describe the solution you'd like
I would like the deserializer to always enforce the type construction (optionally via a DeserializerBuilder option like WithEnforceConstructorCall() ?), or change the interface return type to T? to make it clear to the user, that null is a possibility.
Describe alternatives you've considered
Override/ignore compiler info/warning and do a null-check on the returned instance regardless.
Additional context
There may be built-in deserializer options I did not see and this might also be possible with custom type converters, object factories, etc. If that is the case, please let me know.
The text was updated successfully, but these errors were encountered:
Can you not do something like this deserialize.Deserialize<SomeclassName?>(yamltext);
Or are you saying that you would just expect the interface to already have the nullable attribute by default? I think that could be a breaking change, albeit just compiler warnings but it would be annoying for existing consumers to suddenly need nullable checks or directives to get rid of them.
Is your feature request related to a problem? Please describe.
Currently, the
IDeserializer.Deserialize<T>
methods return null if the parsed string is empty (or whitespaces). However, because the interface description declares the return type asT
and notT?
it is not immediately obvious thatnull
can even be a valid return value.Describe the solution you'd like
I would like the deserializer to always enforce the type construction (optionally via a
DeserializerBuilder
option likeWithEnforceConstructorCall()
?), or change the interface return type toT?
to make it clear to the user, thatnull
is a possibility.Describe alternatives you've considered
Override/ignore compiler info/warning and do a null-check on the returned instance regardless.
Additional context
There may be built-in deserializer options I did not see and this might also be possible with custom type converters, object factories, etc. If that is the case, please let me know.
The text was updated successfully, but these errors were encountered: