Skip to content

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

Description

@hinsenchan

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])

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions