Closed josephburnett closed 2 years ago
This would be 👌
A first step would be to emit objects of the form: {path: PATH, old: OLD, new: NEW}
(instead of @ PATH\n- OLD\n+ NEW"
)
Is there any support for this that is undocumented? Is there another tool that does support json-patch style patches? Surprised this issue (#1) hasn't been worked on? Is it in the works or has anyone started a branch? ;-)
Added -f
flag to choose output format (https://github.com/josephburnett/jd/commit/52a000e20c09d5019947a7e2a9d29f20817d7aea). A value of patch
will output an RFC 6901 JSON Patch. Removal is done with test
and remove
ops because jd
diffs are strict and expect a value to be present when removed.
I've closed this because I don't really intend on reading JSON Patch format diffs. I think that writing them is enough. If you need it, please open a feature request issue.
Actually I want to add support for reading back the JSON Patch's that I write so I can add E2E tests and verify round-tripping. So I'm opening this again until the E2E tests for JSON Patch are added.
Okay, I've added E2E tests. And a translate function to turn jd
diffs into JSON Patch format. Here is an example of how to use this with kubectl
: https://github.com/josephburnett/jd#see-what-changes-in-a-kuberentes-deployment
Add support for rendering and reading diffs in JSON Patch format: https://tools.ietf.org/html/draft-ietf-appsawg-json-patch-10