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

Cope with null relationships #859

Closed

Conversation

pdw-mb
Copy link
Contributor

@pdw-mb pdw-mb commented May 16, 2023

I have some data with a nullable relationship. This results in API data like this:

{
    "relationships": {
        "language": {
            "data": null
        }
    }
}

This is valid according to the JSON API spec, but was causing an exception in json-api-merge when trying to resolve this relationship. This PR fixes this, although perhaps there is a more elegant way to do this not-null check in Ramda?

@char0n char0n self-requested a review August 15, 2023 15:47
@char0n char0n self-assigned this Aug 15, 2023
src/index.js Outdated Show resolved Hide resolved
@char0n
Copy link
Member

char0n commented Aug 15, 2023

Hi @pdw-mb,

Thanks for the PR, and opening this up. I've read the spec, and you're absolutely right. What we want to do is to only pick relationships which data prop present and where prop !== null. I'll create a superseding PR with the change and appropriate tests.

char0n added a commit that referenced this pull request Aug 15, 2023
@char0n
Copy link
Member

char0n commented Aug 15, 2023

This PR was superseded by #909. Thanks again @pdw-mb!

@char0n char0n closed this Aug 15, 2023
char0n added a commit that referenced this pull request Aug 15, 2023
char0n pushed a commit that referenced this pull request Aug 15, 2023
## [1.1.5](v1.1.4...v1.1.5) (2023-08-15)

### Bug Fixes

* cope with null relationships ([#909](#909)) ([18766be](18766be)), closes [#859](#859)
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.

None yet

2 participants