mcintyre321 / JsonDiffPatch

Apache License 2.0
50 stars 25 forks source link

If the "name" of a property contains "/", the name is not escaped #13

Closed buehler closed 3 years ago

buehler commented 3 years ago

Relating to #2: If some name (property name) does contain a slash, it is not properly escaped with ~1. I use it with var patch = new JsonDiffer().Diff(@object, result.ModifiedObject, false);.

When using this approach in https://github.com/buehler/dotnet-operator-sdk/blob/master/src/KubeOps/Operator/Webhooks/IMutationWebhook%7BTEntity%7D.cs#L91, when comparing kubernetes deployment "annotations" which do contain /, the slash is not escaped and the resulting add path is: annotations/foo/bar instead of annotations/foo~1bar.

I use version 2.0.52.

Regards

mcintyre321 commented 3 years ago

Thanks for the bug report. I don't have a lot of time to work on this library, but if you can submit a PR with some tests to demonstrate and fix the issue, I will happily review, merge and publish the new code.