I have an API endpoint that retrieve data from 3 SQL tables on the server-side. At the moment, I do a SELECT with joins, consolidate/reorganize the selected data based on a JSON schema, and then send the JSON to client. The point here is that, almost none of the data values is changed, only their structure is transformed from the SQL schema to the JSON schema.
On the client side, I also maintain 3 SQL tables that are very similar to those on the server. At the moment, I parse the JSON, re-transform the data, and save them into those tables.
I wonder, on the server-side, whether we could simply dump the the data from each of the 3 tables into JSON without any transformation, so that both server and client can save doing any transformation/restructuring, considering the tables on both sides (more or less) match in schema.
The (only?) benefit of this idea is obvious, but I do wonder if there is any serious drawback. For examples:
We lose data abstraction on the server-side.
We sort of rely on the close matching between schemas of tables on both sides, which probably makes it harder in the future to change/add columns to those tables on either side.
This may be OK for an internal API that is consumed by clients I control, but probably is not so great for external clients/developers in the future.
So far I can only come up with the above, and I am not 100% sure how severe each of the problems is.