Skip to content

Commit 483430f

Browse files
alltouchdigitalsadhu
authored andcommitted
fix: null response for empty BelongsTo relationship
1 parent 85323a4 commit 483430f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/serializer.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,8 @@ function parseRelations (data, relations, options) {
269269
// No `data` key should be present unless there is actual relationship data.
270270
if (relationship) {
271271
relationships[name].data = relationship
272+
} else if (relation.type === 'belongsTo') {
273+
relationships[name].data = null
272274
}
273275
})
274276

0 commit comments

Comments
 (0)