Giter Site home page Giter Site logo

Feedback on PATCH about api-guidelines HOT 3 CLOSED

microsoft avatar microsoft commented on May 3, 2024
Feedback on PATCH

from api-guidelines.

Comments (3)

darrelmiller avatar darrelmiller commented on May 3, 2024

The PATCH method itself doesn't not define the details of how to actually achieve the PATCH. That is by design. The media types you have found are the two JSON based patch documents that provide these details. Both are valid approaches. Each have their strengths and weaknesses. The second option is definitely the better option for removing things.

from api-guidelines.

bschaeublin avatar bschaeublin commented on May 3, 2024

Thank you for your answer! I thought it would be useful to mention this in the guidline, as there is written about 'update' (which could be including remove..) and 'add' (UPSERT).

Is there any special reason, why the second one is better for removing things?

from api-guidelines.

darrelmiller avatar darrelmiller commented on May 3, 2024

JSON-Patch has an explicit remove operation that can act on any part of the document using a JSON-Pointer. JSON-Merge-Patch requires you to recreate the structure of the target document and use a null value to indicate removal of properties. What happens if null is a valid value for a property?

Removing elements in an array requires sending a copy of the array with the target element removed. This can be less than idea if it is an array of objects.

To be honest, I haven't used JSON Merge patch much, but I have spent many hours trying to resolve issues around doing merge patching. I have written a .Net library for JSON-Patch so maybe I'm just biased :-)

from api-guidelines.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.