aspnet / JsonPatch

[Archived] JSON PATCH library. Project moved to https://github.com/aspnet/AspNetCore
Apache License 2.0
103 stars 48 forks source link

Any plan for supporting the 'test' operation? #53

Closed MienDev closed 7 years ago

MienDev commented 7 years ago

NOT SUPPORTED NOW I found that the test operation is not supported till now. ( JsonPatch, Version=1.1.0.0 )

A part of standard

Refer to rfc6902 section-4.6 from the IETF, test is one of the operations that is specified.

It's useful

test is useful in some scenario. Taking HTTP patch as example, it can be used for checking consistency when going with HTTP PATCH method.

If test operation is supported, we can simply include a consistency stamp as the first operation. if test failed no patch(update) action will take effect.
This can make the patch being more atomic, otherwise we have to implement consistency checking separately( such as an ugly request query parameter.)

// http request payload
[
{op:'test', path:'/consistencyStamp', value:'some value for stamp' },
{op:'replace', path:'/enabled',value:'true'}
// ...  //other operations
]

Thank you, guys

Since JsonPatch is now token as the first-class support in asp.net core, and test operation it's useful, It should be implemented integrally with the standard. Microsoft is great while making .net core open-source, and all of guys like you is cool to do these jobs. come on, It can be more perfect. and many thanks to you man.

zygimantas commented 7 years ago

Duplicate: https://github.com/aspnet/JsonPatch/issues/1

MienDev commented 7 years ago

@zygimantas Thanks for your kind reminder. I'll close this issue, since duplicated. .