Skip to content
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

Deserializer - Fix deserializer when data is null #236

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shilps1583
Copy link

Fixes issue #203

@martinezguillaume
Copy link

Here is my jsonapi-serializer+3.6.9.patch to solve this

diff --git a/node_modules/jsonapi-serializer/lib/deserializer.js b/node_modules/jsonapi-serializer/lib/deserializer.js
index 1cb7c1a..d8fc6e4 100644
--- a/node_modules/jsonapi-serializer/lib/deserializer.js
+++ b/node_modules/jsonapi-serializer/lib/deserializer.js
@@ -31,8 +31,9 @@ module.exports = function (opts) {
           return result
         });
     }
-
-    if (Array.isArray(jsonapi.data)) {
+    if (!jsonapi.data) {
+      return jsonapi.data
+    } else if (Array.isArray(jsonapi.data)) {
       return collection();
     } else {
       return resource();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants