-
Notifications
You must be signed in to change notification settings - Fork 288
http-client-java, support nested pageItems, nextLink, continuationToken #7706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
http-client-java, support nested pageItems, nextLink, continuationToken #7706
Conversation
No changes needing a change description found. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the pagination support in the HTTP client Java package to enable nested pageItems, nextLink, and continuationToken handling. Key changes include:
- Refactoring ClientCoreClientMethodTemplate to use helper methods for nested property extraction with null checks.
- Updating MethodPageDetails and PagingMetadata to use lists (instead of single values) for pageItems and nextLink.
- Adjusting test implementations and code model builder to align with the new nested paging model.
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
ClientCoreClientMethodTemplate.java | Refactored pagination logic to use helper methods (valueLine, nextLinkLine, nestedReferenceLineWithNullCheck) for nested paging properties. |
MethodPageDetails.java | Changed to use List for pageItems and nextLink, accessing the first element for property names. |
PagingMetadata.java | Updated to support list-based extraction of page items and next link properties. |
ClientMethodsReturnDescription.java | Adjusted element type mapping to integrate the new paging properties. |
XmsPageable.java | Added getters/setters for nested pageItems and nextLink properties. |
ServerDrivenPaginationsImpl.java and ServerDrivenPaginationContinuationTokensImpl.java | Updated PagedResponse construction to include redundant null checks for next tokens using the new paging fields. |
operation-utils.ts and code-model-builder.ts | Incorporated new logic for handling nested paging properties in response schemas. |
...a/com/microsoft/typespec/http/client/generator/core/model/clientmodel/MethodPageDetails.java
Show resolved
Hide resolved
...a/com/microsoft/typespec/http/client/generator/core/model/clientmodel/MethodPageDetails.java
Show resolved
Hide resolved
...ientcore-test/src/main/java/payload/pageable/implementation/ServerDrivenPaginationsImpl.java
Show resolved
Hide resolved
.../main/java/payload/pageable/implementation/ServerDrivenPaginationContinuationTokensImpl.java
Show resolved
Hide resolved
You can try these changes here
|
sdkMethod.pagingMetadata.nextLinkSegments, | ||
); | ||
// "nextLinkSerializedName" take 1st property for backward compatibility |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please show what does output code-model.yaml look like?
test would be in #6477
(PS: we may need to skip this tsp in Azure)
impl code looks like this
pageItems
should always be there so there is no null check <- this could be wrong but worry about it later