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

repro(patch): test case for adding an item to the end of an array #299

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants