diegomvh / angular-odata

Client side OData typescript library for Angular
https://www.npmjs.com/package/angular-odata
MIT License
50 stars 14 forks source link

could you please explain why the preferred http method is PUT but not PATCH #85

Closed SamShekhovtsov closed 3 months ago

SamShekhovtsov commented 10 months ago

this is not really a bug report, but a question.

hi. Thanks for the amazing tool. This tool allows to easily generate all the needed client-side code based on the odata backend services, it is very handy and simple to use. It really simplifies a life for developers.

May I ask you whether there is an option to use PATCH http method other than PUT, when updating the entities using the auto - generated oData services?

Could you please explain why the default one is the PUT http method, but not PATCH? PATCH looks like more effective, as it sends to the odata backend services and updates only the modified properties (instead of the entire entity replacement)?

I'm asking here, because I couldn't find this information in the documentation.

diegomvh commented 9 months ago

Hi @SamShekhovtsov To use the http PATCH, the method implemented in the services is modify.

https://github.com/diegomvh/angular-odata/blob/7b680defaaaf198137d9ec1f742710c80a32d0df/projects/angular-odata/src/lib/services/entity-set.ts#L119

Try to give eloquent names for each http method but they may not be good choices.

I hope this helps and thank you very much for giving the library a chance.