You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently I have to declare valueForRelationship for every relationship but many times the function must be applied to all entities so could be nice to have the possibility to declare a general valueForRelationship tha can be replaced per specific relationship.
Here is the diff that solved my problem:
diff --git a/node_modules/jsonapi-serializer/lib/deserializer-utils.js b/node_modules/jsonapi-serializer/lib/deserializer-utils.js
index 1265fd4..b63e3e6 100644
--- a/node_modules/jsonapi-serializer/lib/deserializer-utils.js+++ b/node_modules/jsonapi-serializer/lib/deserializer-utils.js@@ -14,9 +14,9 @@ module.exports = function (jsonapi, data, opts) {
}
function getValueForRelationship(relationshipData, included) {
- if (opts && relationshipData && opts[relationshipData.type]) {- var valueForRelationshipFct = opts[relationshipData.type]- .valueForRelationship;+ if (opts && relationshipData && (opts[relationshipData.type] || opts.valueForRelationship)) {+ var valueForRelationshipFct =+ opts[relationshipData.type]?.valueForRelationship || opts.valueForRelationship;
return valueForRelationshipFct(relationshipData, included);
} else {
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch
[email protected]
for the project I'm working on.Currently I have to declare valueForRelationship for every relationship but many times the function must be applied to all entities so could be nice to have the possibility to declare a general valueForRelationship tha can be replaced per specific relationship.
Here is the diff that solved my problem:
This issue body was partially generated by patch-package.
The text was updated successfully, but these errors were encountered: