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

falsy JavaScript attribute values are getting set to null if nullIfMissing flag is set #241

Open
hinsenchan opened this issue Oct 29, 2020 · 0 comments

Comments

@hinsenchan
Copy link

I was trying to set nulls for missing attributes for a boolean and number attribute where the values are false and 0 respectively. The serializer converted them to nulls because of the falsy value comparison. I believe it is caused by the two lines below...anyone else experience the same thing?

jsonapi-serializer/lib/serializer-utils.js 

line 201 !dest[attr]
line 295 !record[attribute]

I think the fix is likely relatively simple since we're already using Lodash if we can agree missing means undefined?

jsonapi-serializer/lib/serializer-utils.js 

line 201 isUndefined(dest[attr])
line 295 isUndefined(record[attribute])
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

No branches or pull requests

1 participant