Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don’t build empty objects on missing linked resources. #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Shigawire
Copy link

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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant