evanphx / json-patch

A Go library to apply RFC6902 patches and create and apply RFC7386 patches
BSD 3-Clause "New" or "Revised" License
1.06k stars 182 forks source link

Creating RFC6902 Patch Documents #56

Closed seddonm1 closed 6 years ago

seddonm1 commented 6 years ago

Hi, Is there a plan to create the RFC6902 patches as well as applying them? There are a few libraries floating around and this looks to be the most mature so having a canonical implementation of both 6902 and 7396 would be great.

[
  {"op": "replace", "path": "/name", "value": "Jane"},
  {"op": "remove", "path": "/height"}
]
clagraff commented 6 years ago

Hi @seddonm1

Would you by chance have an example of how you'd like to interact with jsonpatch in creating RFC6902 patches?

seddonm1 commented 6 years ago

Hi, i was thinking that you would have a CreateMergePatch method for RFC7396 (existing) and a CreatePatch method for creating RFC6902 patches?

slok commented 6 years ago

Hi!

It this planned to be implemented in a near future?

For example, at this moment some parts of Kubernetes apiserver like the admission webhooks only allow RFC6902 patches, that's why this feature would be interesting.

Thank you!

clagraff commented 6 years ago

Hi @slok , Thanks for the bump.

Any thoughts @evanphx ?

Honestly, it slipped under my radar and I've forgotten about this. 😞 Oops.

I will take a look this week, and see what it'd take to do this. Unless someone else wants to tackle this, I'll see what I can do.

evanphx commented 6 years ago

This is not planned but I'm happy to review a PR on it!

herkyl commented 5 years ago

For the people who stumble upon this issue, I wrote a Go library for creating JSON Patch Documents (RFC6902).

You can create patches using Patchwerk and apply them using evanphx/json-patch.