Skip to content

Commit

Permalink
fix: paginators not respecting start key (#1101)
Browse files Browse the repository at this point in the history
  • Loading branch information
0marperez authored Jun 17, 2024
1 parent 14c6038 commit e639316
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
8 changes: 8 additions & 0 deletions .changes/15fb7dc6-dee9-4f40-adba-a48183d4f432.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"id": "15fb7dc6-dee9-4f40-adba-a48183d4f432",
"type": "bugfix",
"description": "Fix paginators not respecting start key",
"issues": [
"awslabs/aws-sdk-kotlin#1330"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class PaginatorGenerator : KotlinIntegration {
outputSymbol,
) {
withBlock("#T {", "}", ExternalTypes.KotlinxCoroutines.FlowGenerator) {
write("var cursor: #F = null", cursorSymbol)
write("var cursor: #F = initialRequest.$markerLiteral", cursorSymbol)
write("var hasNextPage: Boolean = true")
write("")
withBlock("while (hasNextPage) {", "}") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class PaginatorGeneratorTest {
*/
public fun TestClient.listFunctionsPaginated(initialRequest: ListFunctionsRequest = ListFunctionsRequest { }): Flow<ListFunctionsResponse> =
flow {
var cursor: kotlin.String? = null
var cursor: kotlin.String? = initialRequest.marker
var hasNextPage: Boolean = true
while (hasNextPage) {
Expand Down Expand Up @@ -206,7 +206,7 @@ class PaginatorGeneratorTest {
*/
public fun TestClient.listFunctionsPaginated(initialRequest: ListFunctionsRequest = ListFunctionsRequest { }): Flow<ListFunctionsResponse> =
flow {
var cursor: kotlin.String? = null
var cursor: kotlin.String? = initialRequest.marker
var hasNextPage: Boolean = true
while (hasNextPage) {
Expand Down Expand Up @@ -343,7 +343,7 @@ class PaginatorGeneratorTest {
*/
public fun TestClient.listFunctionsPaginated(initialRequest: ListFunctionsRequest = ListFunctionsRequest { }): Flow<ListFunctionsResponse> =
flow {
var cursor: kotlin.String? = null
var cursor: kotlin.String? = initialRequest.marker
var hasNextPage: Boolean = true
while (hasNextPage) {
Expand Down Expand Up @@ -472,7 +472,7 @@ class PaginatorGeneratorTest {
val expectedCode = """
public fun TestClient.listFunctionsPaginated(initialRequest: ListFunctionsRequest = ListFunctionsRequest { }): Flow<ListFunctionsResponse> =
flow {
var cursor: kotlin.String? = null
var cursor: kotlin.String? = initialRequest.marker
var hasNextPage: Boolean = true
while (hasNextPage) {
Expand Down Expand Up @@ -642,7 +642,7 @@ class PaginatorGeneratorTest {
*/
public fun TestClient.listFunctionsPaginated(initialRequest: ListFunctionsRequest = ListFunctionsRequest { }): Flow<ListFunctionsResponse> =
flow {
var cursor: kotlin.String? = null
var cursor: kotlin.String? = initialRequest.marker
var hasNextPage: Boolean = true
while (hasNextPage) {
Expand Down

0 comments on commit e639316

Please sign in to comment.