Skip to content
This repository has been archived by the owner on Nov 27, 2022. It is now read-only.

[Feature] ✨ Patch multiple resources at once #187

Open
candoumbe opened this issue May 21, 2022 · 0 comments
Open

[Feature] ✨ Patch multiple resources at once #187

candoumbe opened this issue May 21, 2022 · 0 comments
Labels
design 💭 Task or bug related to design/architecture enhancement ✨ New feature or request

Comments

@candoumbe
Copy link
Owner

candoumbe commented May 21, 2022

Is your feature request related to a problem? Please describe.
Being able to partially modify several ressources with a single PATCH operation

Describe the solution you'd like
Adds support for a MultiPatch<TKey, TResource> that could be represented as following :

The main wrapper

class MultiPatch<TKey, TResource>
{
    IEnumerable<MultiPatchItem<TKey, TResource>> Patches { get; set; }
}

Wrapper around one item

class MultiPatchItem<TKey, TResource>>
{
    TKey Id { get; set; }
     JsonPatchDocument<TResource> Operations { get; set; }
}

This could then be called using a specific application/json-patch-multi+json mime type handle by a specific MultiPatchMimeTypeInputFormatter.

Content :

{
  "items": [
    {
      "id": 1,
      "operations": [
        {
          "op": "replace",
          "path": "/baz",
          "value": "boo"
        },
        {
          "op": "add",
          "path": "/hello",
          "value": [
            "world"
          ]
        },
        {
          "op": "remove",
          "path": "/foo"
        }
      ]
    },
    {
      "id": 2,
      "operations": [
        {
          "op": "replace",
          "path": "/baz",
          "value": "boo"
        },
        {
          "op": "add",
          "path": "/hello",
          "value": [
            "world"
          ]
        },
        {
          "op": "remove",
          "path": "/foo"
        }
      ]
    }
  ]
}

Describe alternatives you've considered
Making multiple calls (one for set of operations)

@candoumbe candoumbe added enhancement ✨ New feature or request design 💭 Task or bug related to design/architecture labels May 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
design 💭 Task or bug related to design/architecture enhancement ✨ New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant