Defer RESTSerializer.normalizeResponse


#1

I have two model types, User and Group. User has a hasMany relationship to Group (called groups).

When returning a User, the backend has a relationship to groups that is somewhat broken: Rather than returning IDs for the groups, it returns name (a property on the Group model).

Changing the backend is out of scope at this point, so I need to fix the relationship in my serializer. The problem is that normalizeResponse must return a valid document, it can’t defer with a promise to resolve. In order to map the group name to get the group ID, I would have to make an asynchronous request.

Does anyone have a suggestion about how I can accomplish this with the least amount of friction?