Azure / autorest.java

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

Unbranded CodeGen should generate paging operation with Azure Style #2992

Open lirenhe opened 5 days ago

lirenhe commented 5 days ago

TypeSpec already includes the support of Paging operation for unbranded: https://typespec.io/docs/standard-library/pagination/

Based on the current agreement, with @list, @pageItems and @nextLink, we could generate the paging operation similar with Azure style. Please also ensure related models for paging are added into unbranded core.

weidongxu-microsoft commented 3 days ago

A few options

  1. generate return model for each API as e.g. ListTodoItemPagedIterable which support stream and iterate (by item and by page). apparent downside is that it makes up a name, which also makes it susceptible to naming conflict.
  2. generate template e.g. PagedIterable<> which support stream and iterate (by item and by page), then API returns e.g. PagedIterable<TodoItem> it could be confusing if multiple such SDK is used together. but fine if only 1 SDK used.
  3. Have PagedIterable in clientcore

To me, seems (2) is fine.