Skip to content

Commit 2550e03

Browse files
authored
allow isTruncated to be optional bool (#626)
1 parent 794b36b commit 2550e03

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Sources/ClientRuntime/Pagination/PaginatorSequence.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ public struct PaginatorSequence<OperationStackInput: PaginateToken, OperationSta
1212
let input: OperationStackInput
1313
let inputKey: KeyPath<OperationStackInput, OperationStackInput.Token?>?
1414
let outputKey: KeyPath<OperationStackOutput, OperationStackInput.Token?>
15-
var isTruncatedKey: KeyPath<OperationStackOutput, Bool>?
15+
var isTruncatedKey: KeyPath<OperationStackOutput, Bool?>?
1616
let paginationFunction: (OperationStackInput) async throws -> OperationStackOutput
1717

1818
public init(input: OperationStackInput,
1919
inputKey: KeyPath<OperationStackInput, OperationStackInput.Token?>? = nil,
2020
outputKey: KeyPath<OperationStackOutput, OperationStackInput.Token?>,
21-
isTruncatedKey: KeyPath<OperationStackOutput, Bool>? = nil,
21+
isTruncatedKey: KeyPath<OperationStackOutput, Bool?>? = nil,
2222
paginationFunction: @escaping (OperationStackInput) async throws -> OperationStackOutput) {
2323
self.input = input
2424
self.inputKey = inputKey
@@ -51,7 +51,7 @@ public struct PaginatorSequence<OperationStackInput: PaginateToken, OperationSta
5151

5252
// Use isTruncatedKey from the sequence to check if pagination should continue
5353
if let isTruncatedKey = sequence.isTruncatedKey {
54-
let isTruncated = output[keyPath: isTruncatedKey]
54+
let isTruncated = output[keyPath: isTruncatedKey] ?? false
5555
if !isTruncated {
5656
// set token to nil to break out of the next iteration
5757
token = nil

0 commit comments

Comments
 (0)