consider SPA application which uses centralized store like ngxs or vuex. Are there some recommendations about response of REST API? Any specifications where I can read more about that?
For instance, I have domain object
ObjectA which has about 12 fields. In case when I need show collection of that object in table grid (only name field) should I return whole that objects with all fields from REST controller or return only list of strings?
In my previous app I always fetch whole objects. When I had objects
ObjectB where one of fields of
ObjectA has type
ObjectB. Instead of creating DTO for that purpose which I adjust to hold only 1 required field of
ObjectB I put whole
ObjectB in response and store it in vuex as is.
Which way do you prefer or which is recommended? Sending and work with whole objects when you need 1-2 fields of that object at the expense of greater payload or always break objects and send only fields which I need? Thank you in advance!