Issue descritpion
Given the following code snippets:
StructuredQuery s = StructuredQuery.onEntity("A", V4)
.select(StructuredQuery.onEntity("B", V4) // isRoot = true
.withInlineCount());
s.getQueryString();
Output: $expand=B($count=true) 👍
StructuredQuery s2 = StructuredQuery.onEntity("A", V4)
.select(StructuredQuery.asNestedQueryOnProperty("B", V4) // isRoot = false
.withInlineCount());
s2.getQueryString();
Output: $expand=B unexpected 👎
Root cause
The issue is that the QuerySerializer checks the query.isRoot() and renders custom parameters only if statement is true. However for the inlineCount option of an expanded subquery this fails and produces the wrong result.
As CAP Java relies on the Cloud SDK impl and translates the CDS queries generically this causes the issues for our stakeholders.
I see here 2 options:
- either add a whitelist of custom parameters to be always rendered (disregarding whether it's root or not), like
inlineCount;
- simply render all custom params that the user specified.
Steps to Reproduce
StructuredQuery s = StructuredQuery.onEntity("A", V4)
.select(StructuredQuery.onEntity("B", V4) // root
.withInlineCount());
Output: $expand=B($count=true) as expected
StructuredQuery s2 = StructuredQuery.onEntity("A", V4)
.select(StructuredQuery.asNestedQueryOnProperty("B", V4) // nested
.withInlineCount());
Output: $expand=B unexpected
Expected Behavior
Output: $expand=B($count=true)
Used Versions
Apache Maven 3.9.12
Java version: 25.0.3, vendor: SAP SE
CAP Java: 5.0.0-SNAPSHOT
Issue descritpion
Given the following code snippets:
Output:
$expand=B($count=true)👍Output:
$expand=Bunexpected 👎Root cause
The issue is that the
QuerySerializerchecks thequery.isRoot()and renders custom parameters only if statement istrue. However for the inlineCount option of an expanded subquery this fails and produces the wrong result.As CAP Java relies on the Cloud SDK impl and translates the CDS queries generically this causes the issues for our stakeholders.
I see here 2 options:
inlineCount;Steps to Reproduce
Output:
$expand=B($count=true)as expectedOutput:
$expand=BunexpectedExpected Behavior
Output:
$expand=B($count=true)Used Versions
Apache Maven 3.9.12
Java version: 25.0.3, vendor: SAP SE
CAP Java: 5.0.0-SNAPSHOT