user2793390
user2793390

Reputation: 771

jsonapi - include external resource

I'm trying to do an inclusion between Resources that are handled by different services. Both services use Katharsis. Let's assume those resources are Book and Publisher. I want to be able to include a publisher when GETing a book resource.

I know I could have the Book service do an HTTP call to the Publisher service. The issue here is that I'd get a JSON representation of the Publisher. I'd have to deserialize it into a Publisher POJO and put in in the Book POJO. Then Katharsis would serialize the whole thing again w/ the included Publisher.

One problem is the Book service would need to have knowledge of the Publisher model and its relationships etc. I suppose I could extract the model from the publisher service into a java api, and include it into the book service. Not sure it's a good practice though.

Another problem relates to the efficiency. I'm deserializing only to serialize again.

Is there a better way? How do people handle this?

Upvotes: 0

Views: 105

Answers (0)

Related Questions