Skip to content

[typespec-ts] Continuation-token paging stops after the first page #5298

Description

Description

Generated pageable iterators for JSON and XML continuation-token operations stop after the first page. Each operation returns two items on its first response and a token for the next request, but iteration completes without issuing that request, so only 2 of the expected 4 items are returned.

Spector service

Reproduction

const jsonItems = await collect(
  client.serverDrivenPagination.continuationToken.requestQueryResponseBody({
    foo: "foo",
    bar: "bar",
  }),
);

const xmlItems = await collect(client.xmlPagination.listWithContinuation());

Actual behavior

JSON items: 2 (expected 4)
XML items: 2 (expected 4)

No second request is sent. The generated paging configuration only identifies the page item property through itemName; it does not contain metadata for extracting the response continuation token or injecting it into the next request's declared query parameter. The generic paging helper consequently treats the first response as the final page. The same metadata gap occurs for the token represented in the XML response model.

Expected behavior

The generated pageable iterator should:

  1. Extract the property marked with @continuationToken from each response, including an XML response body.
  2. Place that token in the operation parameter marked with @continuationToken for the next request.
  3. Continue until the response no longer contains a token.

Both scenarios should yield all four items and issue the expected second request.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    emitter:typescriptIssues for @azure-tools/typespec-ts emitter

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions