DATAREST-1274 - JsonPatch paths now properly verify multi-digit indexes.
This commit is contained in:
@@ -474,7 +474,7 @@ class SpelPath {
|
||||
|
||||
for (String part : parts) {
|
||||
|
||||
if (part.matches("\\d") || APPEND_CHARACTERS.contains(part) || part.isEmpty()) {
|
||||
if (part.matches("\\d+") || APPEND_CHARACTERS.contains(part) || part.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.springframework.data.rest.webmvc.json.patch;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -23,6 +24,11 @@ import java.util.List;
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.rest.webmvc.json.patch.SpelPath.TypedSpelPath;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link SpelPath}.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class SpelPathUnitTests {
|
||||
|
||||
@Test
|
||||
@@ -69,4 +75,9 @@ public class SpelPathUnitTests {
|
||||
|
||||
assertSame(left, right);
|
||||
}
|
||||
|
||||
@Test // DATAREST-1274
|
||||
public void supportsMultiDigitCollectionIndex() {
|
||||
assertThat(SpelPath.of("/11/description").getLeafType(Todo.class), is(typeCompatibleWith(String.class)));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user