Skip to content

Conversation

Allsimon
Copy link

(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. 
@pivotal-issuemaster
Copy link

@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.

@pivotal-issuemaster
Copy link

@Allsimon Thank you for signing the Contributor License Agreement!

@odrotbohm
Copy link
Member

I've created DATAREST-1273.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged

4 participants