jsonapi-serializer icon indicating copy to clipboard operation
jsonapi-serializer copied to clipboard

Relationships with classes

Open spruce opened this issue 5 years ago • 2 comments

I'm using classes for my models. Which means that the function lodash.isPlainObject returns false. Even if it should serialize the relationship.

I changed this https://github.com/SeyZ/jsonapi-serializer/blob/2c3b80fb7e6f95cf6fd25f6750de372c77f24558/lib/serializer-utils.js#L19 to return Array.isArray(obj) || isObjectLike(obj); which yields the correct results for me. To make sure it keeps working I copied existing tests using plain object to use classes instead. They where failing before my fix and now work.

spruce avatar Jan 26 '20 13:01 spruce

I would like to ask if there is any chance this will be merged and released. Due to this bug I have to deploy from local (with edited serializer-utils) instead of using CI/CD. Thanks

michDostal avatar Apr 13 '20 22:04 michDostal

Hey, we need this also on https://github.com/1024pix/pix. This is possible to merge ? If you need help you could add me to maintainer. I could review PR and merge.

VincentHardouin avatar May 28 '20 09:05 VincentHardouin