Azure / autorest.java

Extension for AutoRest (https://github.com/Azure/autorest) that generates Java code
MIT License
33 stars 82 forks source link

Support Page<T> in LRO response type in CADL #1879

Open lirenhe opened 1 year ago

lirenhe commented 1 year ago

This issue was reported in dotnet https://github.com/Azure/autorest.csharp/issues/2905, but I expect Java DPG should also support this. Below is an example CADL with LRO POST action that generates a pageable collection of file URIs.

  #suppress "@azure-tools/cadl-azure-core/use-standard-operations" "ADP data-plane API uses custom LRO response template the LRO actions."
  @doc("Initiates the process of generating SAS signed URIs for accessing the data-stream files.")
  @extension("x-ms-long-running-operation", true)
  @asyncOperationOptions("location")
  @pollingOperation(LongRunningOperationStatus)
  generate is CustomLongRunningResourceCollectionAction<
    DataStreamFile,
    {},
    Page<DataStreamFile>
  >;
weidongxu-microsoft commented 1 year ago

mgmt generated code https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/implementation/NetworkManagementClientImpl.java#L2279

However, mgmt leaves out the LRO part of the API, it only generate the pageable API

PagedFlux<BastionShareableLinkInner> putBastionShareableLinkAsync

not the LRO + pageable

PollerFlux<T, PagedFlux<BastionShareableLinkInner>> beginPutBastionShareableLinkAsync

(I am not sure whether this thing is even valid)

So, basically we do not know what be the method signature.

weidongxu-microsoft commented 1 year ago

ADP removed this. So lower priority.

Discussed with Srikanta, actually we'd like API arch and SDK arch to have guideline on this case. Currently there is no guideline on LRO + pageable, and it is rarely used (if ever) in data-plane.