SeyZ / jsonapi-serializer

A Node.js framework agnostic library for (de)serializing your data to JSON API
MIT License
735 stars 196 forks source link

Fix relationships when two types start with the same string #229

Open JulienPradet opened 4 years ago

JulienPradet commented 4 years ago

Hi :wave:

First of all, thanks for open sourcing this lib !

I've found a bug when working with a JSON API that have both the products and productsearch type. It created a conflict when looking for an ancestry and the products's relationships weren't included although they should be.

Before this PR, json.product.image didn't exist in the test I've added.

Not sure if ; is the best separator here but since there is already : in use I guess it's OK.

ahinvision commented 4 years ago

Please merge - we are running into the same problem

csprle commented 4 years ago

We could use this fix as well here. Please consider merging @SeyZ :)

Bodasia commented 10 months ago

@SeyZ I'm so sorry, could you possibly share the maintenance of this repository with someone else so that someone can develop this package? Thanks. Also @JulienPradet This pull request fixes the issue but creates another, namely an extra nesting of data, "user": { "id": 1, "profile": { "user": "id": 1, ... }}}.

Bodasia commented 10 months ago

@slimee maybe you have access to resolve this issue?