Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add operation on array #109

Open
Eldelshell opened this issue Oct 14, 2021 · 1 comment
Open

Add operation on array #109

Eldelshell opened this issue Oct 14, 2021 · 1 comment

Comments

@Eldelshell
Copy link

Eldelshell commented Oct 14, 2021

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
    ]
}
@gabrielsson
Copy link

Just a thought. The path "/roles" is pointing to the whole array.

If you would patch "/roles/-" would add additional roles I believe or "/roles/0".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants