raphaelstolt / php-jsonpatch

JSON Patch implementation for PHP
MIT License
93 stars 24 forks source link

Json Merge Patch #4

Closed Spomky closed 9 years ago

Spomky commented 9 years ago

Hi,

Thank you for your library. It works fine on my REST API.

The problem is that clients have to enter in a calculation process to generate these pachs and it becomes sometimes weird. I saw the RFC 7386 describes a Json Merge Patch format which is more "natural" and easy to use on client side.

It will be great if this library could provide support of these patchs or if you could create a new library for that.

clue commented 9 years ago

Hi @Spomky, I believe this is somewhat out of scope for this library.

Both "JSON Patch" (RFC 6902) and "JSON Merge Patch" (RFC 7398) have valid use cases and follow a different approach. While the former is significantly more powerful, the latter is significantly easier to use.

Depending on your specific use case, it may make sense to use "Content-Type" switching in your REST API and accept both formats.

If you're looking for a JSON Merge patch implementation, check out https://github.com/clue/php-json-merge-patch (sorry for the spam :) )