I am currently building an API that requires me to follows JSONAPI schema.
To achieve the correct serialized response, I make use of the ts-japi package. This package allows me to configure serializers for each specific resource/entity.
I make use of this in conjunction with nest interceptors so that my entities can simply be returned from controllers, and the interceptor can serialize the response in JSONAPI format.
My jsonapi interceptor depends on serializers I've mentioned before. The jsonapi serializers dependencies that I provide are generic types.
My approach was working fine when I was registering only 1 serializer per module.
The problem is, when I now register serializers for two different entities, the resolved serializer provided to the jsonapi interceptor is always the first one in the providers array even if I have specified the correct interceptor in the controller.
Code snippet to follow.