Skip to content

Conversation

@radhgupta
Copy link
Member

@radhgupta radhgupta commented Oct 23, 2025

This pull request refactors how method types are defined and used throughout the client model generator codebase. The main change is the introduction of a centralized MethodType enum within ScmMethodProvider, replacing the previous scattered and internal definitions. This improves code clarity, maintainability, and consistency when handling different method types (CreateRequest, Protocol, Convenience) in both implementation and tests.

Core Refactoring:

  • Centralized the definition of method types by introducing the MethodType enum in ScmMethodProvider, with clear documentation for each type. Added convenience properties for checking method type.

Codebase-wide Adoption:

  • Updated all usages of method types in RestClientProvider, ScmMethodProviderCollection, and related classes to use ScmMethodProvider.MethodType instead of the old internal enum.

Removal of Duplicated Enum:

  • Removed the old internal MethodType enum from RestClientProvider, ensuring there is a single source of truth for method types.

Test Updates:

  • Updated all affected tests in RestClientProviderTests to use the new ScmMethodProvider.MethodType enum for parameterized testing and assertions

These changes collectively improve code consistency, reduce duplication, and make the handling of client method types more robust and maintainable.#8037

@microsoft-github-policy-service microsoft-github-policy-service bot added the emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp label Oct 23, 2025
@github-actions
Copy link
Contributor

No changes needing a change description found.

@radhgupta radhgupta marked this pull request as ready for review October 29, 2025 15:40
Copy link
Contributor

@jorgerangel-msft jorgerangel-msft left a comment

Choose a reason for hiding this comment

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

Thanks for contributing! It's looking good. I do see several build errors in CI that will also need to be addressed.

@radhgupta radhgupta added this pull request to the merge queue Nov 3, 2025
Merged via the queue into microsoft:main with commit c5708d5 Nov 3, 2025
22 checks passed
@radhgupta radhgupta deleted the type-for-scmMethodProvider branch November 3, 2025 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants