DATAMONGO-2523 - Fix Json binding of SpEL expressions in arrays.
The closing bracket must not have a leading whitespace. Original pull request: #859.
This commit is contained in:
committed by
Mark Paluch
parent
b57e571033
commit
32f3e60c9f
@@ -231,7 +231,7 @@ class JsonScanner {
|
||||
|
||||
parenthesisCount--;
|
||||
if (parenthesisCount == 0) {
|
||||
buffer.read();
|
||||
c = buffer.read();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,6 +256,14 @@ class ParameterBindingJsonReaderUnitTests {
|
||||
.isEqualTo(new Document("name", new Document("$in", Collections.singletonList("dalinar,kohlin"))));
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-2523
|
||||
void bindSpelExpressionInArrayCorrectly/* closing bracket must not have leading whitespace! */() {
|
||||
|
||||
Document target = parse("{ $and : [?#{ [0] == null ? { '$where' : 'true' } : { 'v1' : { '$in' : {[0]} } } }]}", 1);
|
||||
|
||||
assertThat(target).isEqualTo(Document.parse("{\"$and\": [{\"v1\": {\"$in\": [1]}}]}"));
|
||||
}
|
||||
|
||||
private static Document parse(String json, Object... args) {
|
||||
|
||||
ParameterBindingJsonReader reader = new ParameterBindingJsonReader(json, args);
|
||||
|
||||
Reference in New Issue
Block a user