Comments (4)
up
from jsonapi-serializer.
I have hit the same issue, and it appears to be a problem with how the code is detecting recursive relationships. If any of the parents have types that are a substring of the child type they will be detected as a recursive relation e.g. from your example because elements-layouts-profiles contains the string elements it won't keep parsing relations.
To work around this, in deserializer utils I have updated the check to look at type and id instead of just type when detecting a recursion.
... function findIncluded(relationshipData, ancestry) { ... if (included) { // To prevent circular references, check if the record type // has already been processed in this thread if (ancestry.indexOf(included.type + included.id) > -1) { ...
I noticed I never replied to this, but still thanks @danielpigott.
We distribute this package onto our servers automatically so for now we're still on 3.6.5 since the issue doesn't occur there. It would be nice if this issue could be fixed in a future version so we can use the newest package.
from jsonapi-serializer.
I have hit the same issue, and it appears to be a problem with how the code is detecting recursive relationships. If any of the parents have types that are a substring of the child type they will be detected as a recursive relation e.g. from your example because elements-layouts-profiles contains the string elements it won't keep parsing relations.
To work around this, in deserializer utils I have updated the check to look at type and id instead of just type when detecting a recursion.
...
function findIncluded(relationshipData, ancestry) {
...
if (included) {
// To prevent circular references, check if the record type
// has already been processed in this thread
if (ancestry.indexOf(included.type + included.id) > -1) {
...
from jsonapi-serializer.
up
from jsonapi-serializer.
So support for this library has been down. I've been recently going around the other serializers checking for people who are looking for a better serializer. Over the past few days I've designed a resource-recursive, typescript/javascript library for serializing the entire JSON:API spec. You might want to check it out if this library doesn't fix the recursion :)
Link: https://github.com/jun-sheaf/ts-japi
from jsonapi-serializer.
@danielpigott @ev8dev @kln @Roriz 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
from jsonapi-serializer.
Related Issues (20)
- feat: On deserialization it would be nice if the meta, links, etc, are available as a Symbol in the data
- How can I build deep relationships with my serializer HOT 1
- Automatically calculate attribute list
- What is the difference between `ref` and `id`? HOT 2
- Strange issue with nested relationship deserializing HOT 3
- Support has died. See description. HOT 2
- deserialize does not deserializer links inside relationships objects HOT 3
- Express inside examples is set to version 0.0.0.0 which detects it as vulnerable by scanning tools like Twistlock
- falsy JavaScript attribute values are getting set to null if nullIfMissing flag is set
- How to deserialize with different type?
- Can't Make Relationship Work
- Ability to prefix 'meta' and 'links' key on deserialization HOT 1
- Deserializer [relationships] without [included] field wont work HOT 1
- would not be nice to have a generic valueForRelationship? HOT 1
- How to show all atributte relationships?
- Slow deserialization for specific input HOT 1
- Is it possible to customize the value of the type key? HOT 1
- meta data for Resource Identifier Objects
- Express name throws vulnerability error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsonapi-serializer.