Details

    • Type: New Feature New Feature
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 1.1
    • Labels:
      None

      Description

      Consider adding support for JSON Patch. The RFC is at http://tools.ietf.org/html/rfc6902

      Perhaps, it can be used for transforming one JsonObject/JsonArray to another (works well since JsonObject/JsonArray are immutable)

        Activity

        Hide
        kchung added a comment -

        I've committed the fix. However, I cannot cause ArrayIndexOutOfBoundsException to happen. I thought NodeReference take care of it already.

        Show
        kchung added a comment - I've committed the fix. However, I cannot cause ArrayIndexOutOfBoundsException to happen. I thought NodeReference take care of it already.
        Hide
        asotobu added a comment -

        Cool, I have a use case where this ArrayIndexOutOfBounds occurs. I will update the code and run the test suite again and if the problem still happens I will fix it and push the changes. I remember that the exception occurs in JsonPointer class and not in NodeReference but I will take a look.

        Also I am going to implement the diff operation during next week.

        Alex.

        Show
        asotobu added a comment - Cool, I have a use case where this ArrayIndexOutOfBounds occurs. I will update the code and run the test suite again and if the problem still happens I will fix it and push the changes. I remember that the exception occurs in JsonPointer class and not in NodeReference but I will take a look. Also I am going to implement the diff operation during next week. Alex.
        Hide
        asotobu added a comment -

        Hi I have found that this operation:

        {
                    "op": { "op": "replace", "path": "", "value": false },
                    "target": { "x": { "a": "b", "y": {} } },
                    "expected": false
        }
        

        Throws that a value cannot add to root element, only object and array. In previous comment you mention (or I understood) that this was fixed. Do you think that replace should be have the same behavior as add? If you think so I can fix it or if you want you can fix it as well.

        Alex.

        Show
        asotobu added a comment - Hi I have found that this operation: { "op" : { "op" : "replace" , "path" : "", " value": false }, "target" : { "x" : { "a" : "b" , "y" : {} } }, "expected" : false } Throws that a value cannot add to root element, only object and array. In previous comment you mention (or I understood) that this was fixed. Do you think that replace should be have the same behavior as add? If you think so I can fix it or if you want you can fix it as well. Alex.
        Hide
        kchung added a comment - - edited

        @Alex Please read my comments (4 before this). I think value can only be JsonStructure in this case.

        The spec says

        This operation is functionally identical to a "remove" operation for a value, followed immediately by an "add" operation at the same location with the replacement value.

        Since we disallow JSON root for remove, we should also disallow it for replace.

        Show
        kchung added a comment - - edited @Alex Please read my comments (4 before this). I think value can only be JsonStructure in this case. The spec says This operation is functionally identical to a "remove" operation for a value, followed immediately by an "add" operation at the same location with the replacement value. Since we disallow JSON root for remove, we should also disallow it for replace.
        Hide
        asotobu added a comment -

        Sorry yes this is true I had in mind the #6 comment above that you mention that you will think about it , and don't ask me why but my brain was still thinking on this and not that you already taken a decision. Sorry

        Show
        asotobu added a comment - Sorry yes this is true I had in mind the #6 comment above that you mention that you will think about it , and don't ask me why but my brain was still thinking on this and not that you already taken a decision. Sorry

          People

          • Assignee:
            Unassigned
            Reporter:
            jitu
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated: