-
Notifications
You must be signed in to change notification settings - Fork 196
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
Strange issue with nested relationship deserializing #230
Comments
@TAckos95 So I have been going around looking for those who are struggling to find a proper JSONAPI serializer. Over the past few days I've designed a resource-recursive, typescript/javascript library for serializing the entire JSON:API spec. Our API is far more fluent (and obvious) than the one here (and every other serializer I have seen/used). If this serializer doesn't fit your need, you might want to check it out :) Development is active. If you are in particular struggling with issues such as links, resource relationships, and deep recursion (essentially any of the complicated parts of the JSON:API spec), I strongly recommend moving to our library. {TS:JAPI}: https://github.com/jun-sheaf/ts-japi |
Update: Issue doesn't exist on version So this problem is solved with downgrading the version. But then actually there are problems with circular dependencies, which are even worse than this one. So I created a fix for it (waiting for merge). @jun-sheaf thanks for the info. I checked it out, and a problem I found with it is that it doesn't have a deserializer implemented yet, and this issue is in regarding to deserialization of data. |
I see. Well we are trying to implement a deserializer. The issue lies in trying to do it properly. We currently have an issue up if you would like to contribute your opinion. mathematic-inc/ts-japi#2 |
I found one very strange bug working with this library. What happens is that in some cases nested relationships (which are included as well in "included" list) do get serialized and sometimes they don't. I actually took the example from your tests (this one), pasted it beside my non-working example, adapted both to look exactly the same, and tried to figure out what went wrong.
Conclusion is very strange. Apparently when "data" type has "relationship" type on it's beginning, that relationship won't resolve it's relationships even though they are included. It sound's strange, but here is an adapted example taken from earlier mentioned tests.
In given example, console would look as expected, it would have user attributes, and
address
attribute containing all of the "address" relationship attributes andlock
attribute, containing all of the "lock" relationship attributes.But, if you change top level data type from
"users"
to"addressUsers"
(or anything that starts with "address") it would just skip "lock" part, and the result would look like this:I'm not sure how is that possible, or what is going on in the background, but this is a real problem for me, and it'd be great if someone could check it out and even provide a solution for it.
Thanks in advance!
The text was updated successfully, but these errors were encountered: