Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 19, 2026

  • Review existing tests for paged operations to understand expected behavior
  • Identify the fix location in methods.ts where @markAsPageable is handled
  • Add missing baseServiceMethod.response.resultSegments assignment for @markAsPageable case
  • Add test case to verify resultSegments is populated when using @markAsPageable
  • Build project and run tests to verify the fix works correctly
  • Run full test suite for mark-as-pageable and paged-operation tests (40 tests passed)
  • Run linter to ensure code style is correct (no issues found)
  • Run code review (no issues found)
  • Add resultSegments assertions to all applicable tests in mark-as-pageable.test.ts
  • Remove "issue fix" notes from test comments
  • Add changeset for the fix
  • Add context.__pagedResultSet.add(responseType) call for @markAsPageable to match normal paging behavior
  • Fix build error by adding null check for responseType
  • Add test for isPagedResultModel with @markAsPageable decorator
  • Fix formatting issues reported in CI
Original prompt

This section details on the original issue you should resolve

<issue_title>[TCGC] resultSegments is not populated in method.response when there is a @markAsPageable decorator</issue_title>
<issue_description>In a regular pageable operation, the method.response.resultSegments should contain the array of properties to walk to get the actual results from the actual response model.
When we make a method as pageable via the decorator, the experience should be exactly the same.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…ecorator

Co-authored-by: ArcturusZhang <10554446+ArcturusZhang@users.noreply.github.com>
…rray

Co-authored-by: ArcturusZhang <10554446+ArcturusZhang@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix resultSegments not populated in method.response Fix: populate resultSegments in method.response for @markAsPageable Jan 19, 2026
Copilot AI requested a review from ArcturusZhang January 19, 2026 07:33
Co-authored-by: ArcturusZhang <10554446+ArcturusZhang@users.noreply.github.com>
Copy link
Member

@ArcturusZhang ArcturusZhang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot please resolve the comment and add a changeset

Co-authored-by: ArcturusZhang <10554446+ArcturusZhang@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 19, 2026

@copilot please resolve the comment and add a changeset

Resolved the comment and added changeset in commit ed4a191. The changeset documents this as a fix to populate method.response.resultSegments for the @markAsPageable decorator.

Co-authored-by: ArcturusZhang <10554446+ArcturusZhang@users.noreply.github.com>
Copilot AI requested a review from ArcturusZhang January 19, 2026 07:49
@ArcturusZhang ArcturusZhang marked this pull request as ready for review January 19, 2026 07:52
@ArcturusZhang
Copy link
Member

@copilot please fix the build error

Co-authored-by: ArcturusZhang <10554446+ArcturusZhang@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 19, 2026

@copilot please fix the build error

Fixed the build error in commit 28d90c5 by adding a null check for responseType before adding it to __pagedResultSet. The responseType can be undefined in some cases, so we now only add it to the set when it's defined.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 19, 2026

Open in StackBlitz

npm i https://pkg.pr.new/Azure/typespec-azure/@azure-tools/typespec-client-generator-core@3800

commit: de972e8

Co-authored-by: ArcturusZhang <10554446+ArcturusZhang@users.noreply.github.com>
@ArcturusZhang
Copy link
Member

@copilot fix the format issue reported in CI

Co-authored-by: ArcturusZhang <10554446+ArcturusZhang@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 20, 2026

@copilot fix the format issue reported in CI

Fixed formatting issue in commit c8bb523 by removing the trailing blank line from the is-paged-result-model.test.ts file.

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.

[TCGC] resultSegments is not populated in method.response when there is a @markAsPageable decorator

3 participants