Add operation on array
Opened this issue · 1 comments
Eldelshell commented
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 commented
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".