Skip to content

Add operation on array #109

Open
Open
@Eldelshell

Description

@Eldelshell

Hi, using version 1.13 with Quarkus 2.2.3

I might be wrong since this isn't quite obvious in the RFC:

If the target location specifies an object member that does not
already exist, a new member is added to the object.

Shouldn't the add operation on an array, add the elements to it?

Currently I'm observing that the array is being replaced. For example, for a existing user with a role "administrator" I wanted to add another role:

Request method:	PATCH
Request URI:	http://localhost:9090/api/user/ZaHkxQxwuv
Body:
[
    {
        "op": "add",
        "path": "/roles",
        "value": [
            "User"
        ]
    }
]
HTTP/1.1 200 OK
Content-Length: 125
Content-Type: application/json

{
    "uuId": "f2e333cf-079e-4403-9051-3e347b7934b1",
    "lastLogin": null,
    "id": "ZaHkxQxwuv",
    "status": "ENABLED",
    "roles": [
        "User" // Admin is missing
    ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions