Skip to content

Commit

Permalink
cadl, revert default csv to odata test case (#1986)
Browse files Browse the repository at this point in the history
  • Loading branch information
weidongxu-microsoft authored Feb 17, 2023
1 parent 02c513d commit 7d519e7
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 22 deletions.
12 changes: 10 additions & 2 deletions cadl-tests/cadl/odata.cadl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,15 @@ interface OdataOp {
@query skip?: int32,
@query top?: int32,
@query maxpagesize?: int32,
@query select?: string[],
@query expand?: string[]

@query({
format: "csv",
})
select?: string[],

@query({
format: "csv",
})
expand?: string[]
): ResourceCollection;
}
25 changes: 13 additions & 12 deletions cadl-tests/src/main/java/com/cadl/odata/OdataAsyncClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.cadl.odata.implementation.OdataClientImpl;
import com.cadl.odata.models.Resource;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import reactor.core.publisher.Flux;

Expand Down Expand Up @@ -51,8 +52,8 @@ public final class OdataAsyncClient {
* <tr><td>skip</td><td>Integer</td><td>No</td><td>The skip parameter</td></tr>
* <tr><td>top</td><td>Integer</td><td>No</td><td>The top parameter</td></tr>
* <tr><td>maxpagesize</td><td>Integer</td><td>No</td><td>The maxPageSize parameter</td></tr>
* <tr><td>select</td><td>List&lt;String&gt;</td><td>No</td><td>Array of Filter. Call {@link RequestOptions#addQueryParam} to add string to array.</td></tr>
* <tr><td>expand</td><td>List&lt;String&gt;</td><td>No</td><td>Array of Filter. Call {@link RequestOptions#addQueryParam} to add string to array.</td></tr>
* <tr><td>select</td><td>List&lt;String&gt;</td><td>No</td><td>Array of Filter. In the form of "," separated string.</td></tr>
* <tr><td>expand</td><td>List&lt;String&gt;</td><td>No</td><td>Array of Filter. In the form of "," separated string.</td></tr>
* </table>
*
* You can add these to a request with {@link RequestOptions#addQueryParam}
Expand Down Expand Up @@ -126,18 +127,18 @@ public PagedFlux<Resource> list(
requestOptions.addQueryParam("maxpagesize", String.valueOf(maxPageSize));
}
if (select != null) {
for (String paramItemValue : select) {
if (paramItemValue != null) {
requestOptions.addQueryParam("select", paramItemValue);
}
}
requestOptions.addQueryParam(
"select",
select.stream()
.map(paramItemValue -> Objects.toString(paramItemValue, ""))
.collect(Collectors.joining(",")));
}
if (expand != null) {
for (String paramItemValue : expand) {
if (paramItemValue != null) {
requestOptions.addQueryParam("expand", paramItemValue);
}
}
requestOptions.addQueryParam(
"expand",
expand.stream()
.map(paramItemValue -> Objects.toString(paramItemValue, ""))
.collect(Collectors.joining(",")));
}
PagedFlux<BinaryData> pagedFluxResponse = list(requestOptions);
return PagedFlux.create(
Expand Down
4 changes: 2 additions & 2 deletions cadl-tests/src/main/java/com/cadl/odata/OdataClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public final class OdataClient {
* <tr><td>skip</td><td>Integer</td><td>No</td><td>The skip parameter</td></tr>
* <tr><td>top</td><td>Integer</td><td>No</td><td>The top parameter</td></tr>
* <tr><td>maxpagesize</td><td>Integer</td><td>No</td><td>The maxPageSize parameter</td></tr>
* <tr><td>select</td><td>List&lt;String&gt;</td><td>No</td><td>Array of Filter. Call {@link RequestOptions#addQueryParam} to add string to array.</td></tr>
* <tr><td>expand</td><td>List&lt;String&gt;</td><td>No</td><td>Array of Filter. Call {@link RequestOptions#addQueryParam} to add string to array.</td></tr>
* <tr><td>select</td><td>List&lt;String&gt;</td><td>No</td><td>Array of Filter. In the form of "," separated string.</td></tr>
* <tr><td>expand</td><td>List&lt;String&gt;</td><td>No</td><td>Array of Filter. In the form of "," separated string.</td></tr>
* </table>
*
* You can add these to a request with {@link RequestOptions#addQueryParam}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ Mono<Response<BinaryData>> listNext(
* <tr><td>skip</td><td>Integer</td><td>No</td><td>The skip parameter</td></tr>
* <tr><td>top</td><td>Integer</td><td>No</td><td>The top parameter</td></tr>
* <tr><td>maxpagesize</td><td>Integer</td><td>No</td><td>The maxPageSize parameter</td></tr>
* <tr><td>select</td><td>List&lt;String&gt;</td><td>No</td><td>Array of Filter. Call {@link RequestOptions#addQueryParam} to add string to array.</td></tr>
* <tr><td>expand</td><td>List&lt;String&gt;</td><td>No</td><td>Array of Filter. Call {@link RequestOptions#addQueryParam} to add string to array.</td></tr>
* <tr><td>select</td><td>List&lt;String&gt;</td><td>No</td><td>Array of Filter. In the form of "," separated string.</td></tr>
* <tr><td>expand</td><td>List&lt;String&gt;</td><td>No</td><td>Array of Filter. In the form of "," separated string.</td></tr>
* </table>
*
* You can add these to a request with {@link RequestOptions#addQueryParam}
Expand Down Expand Up @@ -228,8 +228,8 @@ private Mono<PagedResponse<BinaryData>> listSinglePageAsync(RequestOptions reque
* <tr><td>skip</td><td>Integer</td><td>No</td><td>The skip parameter</td></tr>
* <tr><td>top</td><td>Integer</td><td>No</td><td>The top parameter</td></tr>
* <tr><td>maxpagesize</td><td>Integer</td><td>No</td><td>The maxPageSize parameter</td></tr>
* <tr><td>select</td><td>List&lt;String&gt;</td><td>No</td><td>Array of Filter. Call {@link RequestOptions#addQueryParam} to add string to array.</td></tr>
* <tr><td>expand</td><td>List&lt;String&gt;</td><td>No</td><td>Array of Filter. Call {@link RequestOptions#addQueryParam} to add string to array.</td></tr>
* <tr><td>select</td><td>List&lt;String&gt;</td><td>No</td><td>Array of Filter. In the form of "," separated string.</td></tr>
* <tr><td>expand</td><td>List&lt;String&gt;</td><td>No</td><td>Array of Filter. In the form of "," separated string.</td></tr>
* </table>
*
* You can add these to a request with {@link RequestOptions#addQueryParam}
Expand Down Expand Up @@ -276,8 +276,8 @@ public PagedFlux<BinaryData> listAsync(RequestOptions requestOptions) {
* <tr><td>skip</td><td>Integer</td><td>No</td><td>The skip parameter</td></tr>
* <tr><td>top</td><td>Integer</td><td>No</td><td>The top parameter</td></tr>
* <tr><td>maxpagesize</td><td>Integer</td><td>No</td><td>The maxPageSize parameter</td></tr>
* <tr><td>select</td><td>List&lt;String&gt;</td><td>No</td><td>Array of Filter. Call {@link RequestOptions#addQueryParam} to add string to array.</td></tr>
* <tr><td>expand</td><td>List&lt;String&gt;</td><td>No</td><td>Array of Filter. Call {@link RequestOptions#addQueryParam} to add string to array.</td></tr>
* <tr><td>select</td><td>List&lt;String&gt;</td><td>No</td><td>Array of Filter. In the form of "," separated string.</td></tr>
* <tr><td>expand</td><td>List&lt;String&gt;</td><td>No</td><td>Array of Filter. In the form of "," separated string.</td></tr>
* </table>
*
* You can add these to a request with {@link RequestOptions#addQueryParam}
Expand Down

0 comments on commit 7d519e7

Please sign in to comment.