Skip to content

Refactor ClientMethod to Support Immutable Builders and Enhance Polling & Paging Metadata #7015

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

Merged
merged 44 commits into from
May 9, 2025

Conversation

anuchandy
Copy link
Member

@anuchandy anuchandy commented Apr 16, 2025

The PR introduces structural changes to the ClientMethodMapper - focusing on immutability, separation of concerns and consistency.

  1. The ClientMethodMapper now avoids passing mutable builders, reducing potential for dev errors and improving clarity by eliminating the need to save and restore builder states.
  2. Separate functions were created to handle different types of client method creation (paging, LRO, simple). These functions use immutable inputs, except for the methods array they update, and follow a common pattern for easier understanding.
  3. JavaSettings::PollingDetails has been replaced with PollingSettings, which includes updated JavaDoc and improved readability.
  4. New types have been added to consolidate metadata processing for pageable operations (PagingMetadata) and long-running operations (PollingMetadata). PollingMetadata processes PollingSettings and TypeSpec LRO-Metadata and exposes an immutable MethodPollingDetails view on demand. Similarly, PagingMetadata processes TypeSpec paging information and presents an immutable MethodPagingDetails.
  5. The properties in PollingSettings, PollingMetadata, and MethodPollingDetails have been renamed to use consistent names.
  6. Added JavaDoc to ClientMethodsReturnDescription properties.

@microsoft-github-policy-service microsoft-github-policy-service bot added the emitter:client:java Issue for the Java client emitter: @typespec/http-client-java label Apr 16, 2025
Copy link
Contributor

No changes needing a change description found.

@azure-sdk
Copy link
Collaborator

azure-sdk commented Apr 16, 2025

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

@anuchandy anuchandy force-pushed the immutable-client-method branch 15 times, most recently from 8ad1ea7 to 79c3e7f Compare April 25, 2025 06:35
@anuchandy anuchandy force-pushed the immutable-client-method branch from c33c769 to 8019291 Compare April 27, 2025 19:44
@anuchandy anuchandy self-assigned this Apr 28, 2025
@anuchandy anuchandy changed the title [wip] enable newBuilder for the ClientMethod Refactor ClientMethod to Support Immutable Builders and Enhance Polling & Paging Metadata Apr 28, 2025
@anuchandy anuchandy marked this pull request as ready for review April 28, 2025 02:01
Copy link
Member Author

@anuchandy anuchandy left a comment

Choose a reason for hiding this comment

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

This pull request may need to wait for @srnagar pull request if it is expected to be ready soon. Alternatively, the new structure of ClientMethodMapper could be beneficial in terms of simplfying the ClientCoreClientMethodMapper in his pr (if it is in initial scope). I'll let Srikanta decide which option works best based on his plan for that PR.

anuchandy added 19 commits May 7, 2025 12:09
…work to extract fluent out of common client-method-mapper
…g pattern as ClientMethodMapper, naming consistency for all create-client-methods functions
@anuchandy anuchandy force-pushed the immutable-client-method branch from fd97b9c to afc912c Compare May 7, 2025 19:28
@anuchandy anuchandy added this pull request to the merge queue May 9, 2025
Merged via the queue into microsoft:main with commit 64258fd May 9, 2025
24 checks passed
@anuchandy anuchandy deleted the immutable-client-method branch May 9, 2025 20:36
github-merge-queue bot pushed a commit that referenced this pull request May 20, 2025
…g parameter should-hide-check (#7337)

This PR has the following changes -

1. Taking advantages of refactoring done in
[#7015](#7015) for
`ClientMethodMapper` there by deleting the additional code we no longer
needed.
2. Centralizing the derivation and lookup of paging parameters to
`PagingMetadata` and `MethodPageDetails
`.
3. Removing relaxed paging parameter lookup instead using common strict
lookup in all places (azure, client-core etc..).

The AutoRest CI run is
[green](https://dev.azure.com/azure-sdk/internal/_build/results?buildId=4878954&view=results)
with this PR's last commit [80bf3a9].
ArcturusZhang pushed a commit to ArcturusZhang/typespec that referenced this pull request May 21, 2025
…g parameter should-hide-check (microsoft#7337)

This PR has the following changes -

1. Taking advantages of refactoring done in
[microsoft#7015](microsoft#7015) for
`ClientMethodMapper` there by deleting the additional code we no longer
needed.
2. Centralizing the derivation and lookup of paging parameters to
`PagingMetadata` and `MethodPageDetails
`.
3. Removing relaxed paging parameter lookup instead using common strict
lookup in all places (azure, client-core etc..).

The AutoRest CI run is
[green](https://dev.azure.com/azure-sdk/internal/_build/results?buildId=4878954&view=results)
with this PR's last commit [80bf3a9].
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
emitter:client:java Issue for the Java client emitter: @typespec/http-client-java
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants