-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Open
Labels
area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcarea-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesarea-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsfeature-json-patch
Milestone
Description
Is your feature request related to a problem? Please describe.
Implementing JSON Merge Patch manually can be quite tricky but provides a simpler experience for API consumers.
Describe the solution you'd like
Currently there is built-in support for JSON Patch (RFC 6902) via JsonPatchDocument. Would love to also see an implementation of RFC 7386.
So no one has to wade through an RFC...
Given the following JSON representation:
{
"name": "Joe",
"email": "joe@example.com",
"physicalAttributes": { "weight": 75, "height": 175 },
"favoriteColors": ["blue", "red"]
}These two will produce equivalent modifications:
JSON Patch
[
{ "op": "remove", "path": "/email" },
{ "op": "add", "path": "/favoriteColors/-", "value": "black" }
]JSON Merge Patch
{
"email": null,
"favoriteColors": ["blue", "red", "black"]
}Additional context
OData has an implementation of this spec via Delta but it was not designed to work with formatters other than OData.
Here are a couple of open-source implementations:
https://www.strathweb.com/2013/01/easy-asp-net-web-api-resource-updates-with-delta/
https://github.com/Morcatko/Morcatko.AspNetCore.JsonMergePatch
Bringer23, mvacha, mcetkovsky, martincostello, Tiberriver256 and 9 more
Metadata
Metadata
Assignees
Labels
area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcarea-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesarea-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsfeature-json-patch