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

[Issue-69] Adjust relation call for nulled resources #70

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cube-dainis
Copy link

@cube-dainis cube-dainis commented Jan 13, 2025

When requesting a nested include such as destination.location for a stop resource, if the stop does not have a destination attached, the request currently fails with an error. This behavior is inconsistent with the JSON:API specification, which requires that missing nullable relationships should return null.

Solution:

Adjusted the resolveRelationships method in the Relationships trait to handle cases where a requested relationship is missing.

Example Behavior After Fix:

Requesting destination.location for a stop without a destination will return:

"relationships": {
    "destination": {
        "data": null
    }
}

Linked Issue: #69

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