I'm not sure if this has been already discussed elsewhere.. At least I was not able to find such a discussion. If there is one, please point me at it.
It appears that the default HTTP implementation in @ngrx/data uses PUT verb for updates (https://github.com/ngrx/platform/blob/master/modules/data/src/dataservices/default-data.service.ts#L110). And those are 'partial updates' because that is the semantic of the update operation in @ngrx/data & @ngrx/entity. The thing is that HTTP PUT verb is 'not allowed' for partial updates, it is supposed to replace the whole resource. For partial updates PATCH verb is supposed to be uses. Here's the good discussion on the topic: https://stackoverflow.com/questions/19732423/why-isnt-http-put-allowed-to-do-partial-updates-in-a-rest-api with some good links to HTTP RFC and REST papers.
So, while probably not a bug, this behavior does not seem to conform to REST/HTTP spirit/convention. Am I right?
I've found too many conflicting recommendations online - I'd say whichever HTTP verb to use is too dynamic to dictate and should be fully configurable (as should the url e.g. /user/userID/report/reportID). But I write my own api so I can change to suit @ngrx/data. Is @ngrx/data ready for non-api writers? IMHO not yet
Do you ever actually have entities so large that they would benefit from a partial update? And if yes why aren't those fields separate entities if a certain field has to be updated so often that it requires a partial update?
The point to partial updates isn鈥檛 about size. You update my email to yyy from xxx and at I update my phone to 111 from 000. How can server implement both updates if you replace the whole entity?
This would a better discussion to have in the gitter channel
@brandonroberts I think this was closed prematurely. While there are some parts that are still up for discussion (and those could be taken to the gitter channel) I think the original issue that @ngrx/data should at least provide an option for PATCH requests is a valid feature-request.
Indeed, PUT is intended for full updates as per the HTTP specs (cfr RFC 7231) as it is supposed to be an idempotent operation. For partial updates, there's POST & PATCH
I know this issue has been closed (and I've trawled the Glitter channel that the discussion was directed to and could only find this reference) but being able to configure @ngrx/data to use the PATCH verb for partial entity updates would be super helpful and prevent the need for the REST APIs that have been written, IMO correctly, not to have to be change their behaviour.
Most helpful comment
@brandonroberts I think this was closed prematurely. While there are some parts that are still up for discussion (and those could be taken to the gitter channel) I think the original issue that
@ngrx/datashould at least provide an option forPATCHrequests is a valid feature-request.