Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Renders relationship objects even where's no data on included#276

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
andersonmarcelino wants to merge1 commit intoSeyZ:master
base:master
Choose a base branch
Loading
fromandersonmarcelino:feat/add-relationship-without-includes

Conversation

@andersonmarcelino
Copy link

@andersonmarcelinoandersonmarcelino commentedNov 3, 2023
edited
Loading

Issue opened with the description of error:#253

When the deserializer receives a relationship without included data, they just ignore it, but sometimes, for performance uses, we just need the object id, and dont want to include the entire object on response data. This solution add an object with just an in on the output of deserializer.

llpereiras, Roriz, and martinezguillaume reacted with heart emoji
@andersonmarcelinoandersonmarcelino marked this pull request as ready for reviewNovember 3, 2023 16:54
@andersonmarcelinoandersonmarcelino changed the titleRenders relationship objects even wheres no data on includedRenders relationship objects even where's no data on includedNov 3, 2023
@martinezguillaume
Copy link

martinezguillaume commentedJun 13, 2024
edited
Loading

this pr is highly needed & useful ! Is there any way to get it merged ? :)

the filejsonapi-serializer+3.6.9.patch for those who need it

diff --git a/node_modules/jsonapi-serializer/lib/deserializer-utils.js b/node_modules/jsonapi-serializer/lib/deserializer-utils.jsindex 1265fd4..480ab81 100644--- a/node_modules/jsonapi-serializer/lib/deserializer-utils.js+++ b/node_modules/jsonapi-serializer/lib/deserializer-utils.js@@ -26,7 +26,7 @@ module.exports = function (jsonapi, data, opts) {    function findIncluded(relationshipData, ancestry) {     return new Promise(function (resolve) {-      if (!jsonapi.included || !relationshipData) { resolve(null); }+      if (!relationshipData) { resolve(null); }        var included = _find(jsonapi.included, {         id: relationshipData.id,@@ -54,7 +54,7 @@ module.exports = function (jsonapi, data, opts) {             resolve(_extend(attributes, relationships));           });       } else {-        return resolve(null);+        return resolve({ id: relationshipData.id });       }     });   }
andersonmarcelino reacted with heart emoji

if(!relationshipData){resolve(null);}

varincluded=_find(jsonapi.included,{
varincluded=_find(jsonapi.included||[],{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

this line is useless, you can call _find withnull orundefined 👍

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

Reviewers

2 more reviewers

@RorizRorizRoriz approved these changes

@martinezguillaumemartinezguillaumemartinezguillaume approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@andersonmarcelino@martinezguillaume@Roriz

[8]ページ先頭

©2009-2025 Movatter.jp