mardi 28 août 2018

Is it ok to have multiple models for REST API?

In my project, there is one model for a user in the database. Now, I have multiple requests to get specific users. I can get bestUsers which response contains list of JSON's with fewer fields (only these which are needed) - the list of these users is calculated by the server-side algorithm. Now, in the client-side: should I have two models User - for general usage and UserBest - to list the best users or just have one model and serialize only the fields which appear in the JSON (the rest will be null).

I'm writing in Java and using the retrofit library.

Aucun commentaire:

Enregistrer un commentaire