Skip to content

test(spec-sdk): fix paginator response shape after Speakeasy 1.753.0#916

Closed
alexluong wants to merge 1 commit into
mainfrom
fix/spec-sdk-tests-paginator-shape
Closed

test(spec-sdk): fix paginator response shape after Speakeasy 1.753.0#916
alexluong wants to merge 1 commit into
mainfrom
fix/spec-sdk-tests-paginator-shape

Conversation

@alexluong

@alexluong alexluong commented May 28, 2026

Copy link
Copy Markdown
Collaborator

Speakeasy CLI bump (1.741.71.753.0, commit 3f311e0d) wrapped list-operation responses in a PageIterator. The change wasn't flagged in the SDK regen PR changelog, so spec-sdk-tests silently went stale.

Before:

const response = await sdk.events.list({ tenantId });
const events = response.models;

Now:

// Direct access to the first page
const response = await sdk.events.list({ tenantId });
const events = response.result.models;

// Or iterate across pages
const response = await sdk.events.list({ tenantId });
for await (const page of response) {
  for (const event of page.result.models) { ... }
}

// Or step manually via the paginator
let page = await sdk.events.list({ tenantId });
while (page) {
  for (const event of page.result.models) { ... }
  page = await page.next();
}

This PR updates the affected tests (events.test.ts, tenants.test.ts) to the new accessor.


Not necessarily my personal preference (the extra result wrapper feels noisy for the common single-page case), but it appears to be Speakeasy convention for paginated operations — keeps the iterator metadata (next, [Symbol.asyncIterator]) co-located with the parsed body without colliding with response fields.

Speakeasy CLI 1.741.7 → 1.753.0 (commit 3f311e0, 2026-03-13) changed
the generated TS SDK return type for list operations from the flat
paginated body to a PageIterator wrapper: ListEventsResponse now wraps
the body in `result`, so callers access `response.result.models` instead
of `response.models`. The shape change was a side-effect of the
Speakeasy version bump and wasn't surfaced in the SDK regen PR changelog
(which only flagged the unrelated `request` query-param restyle).

Tests in spec-sdk-tests/tests/{events,tenants}.test.ts still used the
pre-bump accessor and failed to compile against the current SDK.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@alexbouchardd

alexbouchardd commented May 28, 2026

Copy link
Copy Markdown
Contributor

Can't we change that? That seems like a totally uncecessary breaking change that actually worst then before...

@alexluong

Copy link
Copy Markdown
Collaborator Author

Agreed that I don't prefer this either, will look into if there's a way to revert this behavior.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants