Looking for some clarification on missing fields: ...
# serialization
p
Looking for some clarification on missing fields: in the code shown below all is well if both fields have valid content. When the
serverInfo
field is missing, a missing field exception is thrown which I did not expect (because of the nullable indication). My conclusion is that this means I need to detect missing fields (using a transforming polymorphic serializer) and explicitly add a null, as in
{"serverInfo":null}
. Would that conclusion be correct or am I missing something?
It would appear that what I was missing is that the idiomatic way to deal with missing fields is to default the field to null. That works in this case.