In a resource-api, the method of updating partial properties of resources can be used with the METHOD patch. Along that, one of the standard people seem to have chosen is JSON PATCH.
As far as I understand, the JSON PATCH standardize in laying operations to alter the a json object. And many of these JSON PATCH libraries have build around this.
However, what I don't understand is that if I'm just allowing a PATCH endpoint to receive changes on some properties of a 'client facing resource'. How do these libraries that offers to object-mutation actually help? its not like my database being just one giant piece of JSON object. Unless maybe a more specific piece of data, like on my sql table, its usage is to specifically change the column data that typed as JSON. then re-update into the SQL table. In that case, should regular column types still confirm to JSONPATCH, how does it get delegated into database changes?
I feel like, unless its actual json type, updating a resources which is coarse grain require a lot of pruning/validations. i.e.
- ensure only some rows are editable
- ensure some operations are only allow
- map changes into SQL specific tables/columns. because any of the client-facing-resource properties could've structured from join table.