Closed zhangguanzhang closed 3 years ago
This package is for generating JSON Patches, not applying them, so I'm not sure what's your question. Moreover, the append
OP isn't specified by the JSON Patch RFC, you should use an add
operation with a path like /path/to/element/-
to append a the end of an array.
the first op add
will add a dnsConfig
to override spec
.
Sorry, is this related to this package ? I still can't tell from your question. Are you generating a patch with jsondiff
?
patch:
[
{
"op":"add",
"path":"/bar",
"value":{
"test111111111":{
"a":1,
"b":2
}
}
}
]
data:
{
"bar" : {
"test": 1
}
}
result:
{
"bar" : {
"test111111111" : {
"a" : 1,
"b" : 2
}
}
}
I expect there has a stronger JsonPatch lib to get this result:
{
"bar" : {
"test": 1,
"test111111111" : {
"a" : 1,
"b" : 2
}
}
}
Assuming that there is a super jsonPatch language, we can use it to change the json of the pod, and then use jsonDiff to generate a regular jsonPatch. The user only needs to write this super jsonPatch to change the properties of the pod in the access control of the pod.
Your patch is valid, see https://tools.ietf.org/html/rfc6902#section-4.1
If the target location specifies an object member that does exist, that member's value is replaced.
I still don't get the link between your issue and this package.
I know this, I mean you can construct a middle-layer jsonPatch, and finally generate a standard jsonPatch
I still don't get what is your point. Are you reporting an issue with the package, or proposing a feature ? You are talking about a "super jsonPatch", but that seems hypothetical to me, there's no such thing that I'm aware of. This package follows the JSON Patch RFC.
Please provide a full explanation of what your trying to achieve, and why, so I can understand what we're talking about, otherwise I won't be able to provide a constructive answer.
Thanks
usefor Kubernetes Dynamic Admission Controller
expect result json is:
also, I expect:
this will append a env to all containers ,not override