json-api-vanilla icon indicating copy to clipboard operation
json-api-vanilla copied to clipboard

Don’t build empty objects on missing linked resources.

Open Shigawire opened this issue 5 years ago • 0 comments

According to the Spec (https://jsonapi.org/format/#document-resource-object-linkage), empty relationships are null by default. Object.new is roughly equal to an empty JSON ({}) in context of this deserializer. It is hard for us to recognize missing or non-present relationships if we have an object with no attributes. To avoid this, instead of a PORO, just nil is returned as reference to a non-present relationships.

Shigawire avatar Jan 13 '20 12:01 Shigawire