json-api-vanilla
json-api-vanilla copied to clipboard
Don’t build empty objects on missing linked resources.
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.