Fix limited DS complete filtering when and becomes comparison (#2780)

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2025-10-28 11:27:06 +02:00
committed by GitHub
parent 46c0c4aeaf
commit 60d6604eff
2 changed files with 13 additions and 3 deletions

View File

@@ -1344,7 +1344,14 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
.andExpect(jsonPath("size", equalTo(10))) .andExpect(jsonPath("size", equalTo(10)))
.andExpect(jsonPath("total", equalTo(10))); .andExpect(jsonPath("total", equalTo(10)));
// and more complex (case insensitive) query // and more complex (logical and to comparison conversion) query
mvc.perform(get("/rest/v1/distributionsets?q=complete==true;valid==true"))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk())
.andExpect(jsonPath("size", equalTo(10)))
.andExpect(jsonPath("total", equalTo(10)));
// and more complex (case-insensitive) query
mvc.perform(get("/rest/v1/distributionsets?q=complete==true;valid==true;id=IN=(" + String.join(",", dsIds) + ")")) mvc.perform(get("/rest/v1/distributionsets?q=complete==true;valid==true;id=IN=(" + String.join(",", dsIds) + ")"))
.andDo(MockMvcResultPrinter.print()) .andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk()) .andExpect(status().isOk())

View File

@@ -135,8 +135,11 @@ public class JpaDistributionSetManagement
sanitizedChildren.add(child); sanitizedChildren.add(child);
} }
}); });
specList.add(QLSupport.getInstance() specList.add(QLSupport.getInstance().buildSpec(
.buildSpec(new Node.Logical(Node.Logical.Operator.AND, sanitizedChildren), DistributionSetFields.class)); sanitizedChildren.size() == 1
? sanitizedChildren.get(0)
: new Node.Logical(Node.Logical.Operator.AND, sanitizedChildren),
DistributionSetFields.class));
} }
if (completedComparison.get() != null) { // really a comparison if (completedComparison.get() != null) { // really a comparison
log.warn("Usage of 'complete' in RSQL is deprecated and will be removed in future: {}", node); log.warn("Usage of 'complete' in RSQL is deprecated and will be removed in future: {}", node);