repro(patch): test case for adding an item to the end of an array
(Sorry I can't login on Jira ATM, I'll create the ticket there as soon as it's working again)
Currently: adding an item with the index equals to the number of elements in the list throws org.springframework.expression.spel.SpelEvaluationException: EL1025E: The collection has '1' elements, index '1' is invalid
For example (in pseudo-code):
let object = {foo: ["Hello"]};
let addOperation = {"op": "add", "path": "/foo/1", "value": "world!"};
addOperation.perform(object);
is a valid JSON Patch operation but throws with Spring
See the RFC:
o An element to add to an existing array - whereupon the supplied
value is added to the array at the indicated location. Any
elements at or above the specified index are shifted one position
to the right. The specified index MUST NOT be greater than the
number of elements in the array. If the "-" character is used to
index the end of the array (see [RFC6901]), this has the effect of
appending the value to the array.
@Allsimon Please sign the Contributor License Agreement!
Click here to manually synchronize the status of this Pull Request.
See the FAQ for frequently asked questions.
@Allsimon Thank you for signing the Contributor License Agreement!
I've created DATAREST-1273.