fix: generate parameterized accessor for subclients with subclient-specific parameters#9919
Merged
JoshLove-msft merged 13 commits intomainfrom Mar 6, 2026
Merged
Conversation
Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
Copilot stopped work on behalf of
JoshLove-msft due to an error
March 4, 2026 20:36
commit: |
…hods Reverts incorrect JS emitter changes and implements the fix in the C# emitter (ClientProvider.cs) where the issue actually belongs. When a subclient has parameters not present on the parent client, the parent's accessor method now accepts those extra parameters and passes them to the subclient constructor. Caching is bypassed for parameterized accessors since different parameter values may produce different client instances. Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
Contributor
Author
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Copilot
AI
changed the title
[WIP] Add subclient parameters to accessors
Add subclient parameters to accessors in the C# emitter
Mar 4, 2026
.chronus/changes/http-client-csharp-subclient-accessor-params-2026-03-04-20-30-00.md
Outdated
Show resolved
Hide resolved
Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
...nt-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs
Show resolved
Hide resolved
Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
Contributor
Author
jorgerangel-msft
approved these changes
Mar 4, 2026
Contributor
|
@copilot run Generate.ps1 and check in the changes |
Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
Contributor
Author
docs/samples/client/csharp/SampleService/SampleClient/src/Generated/SampleTypeSpecClient.cs
Show resolved
Hide resolved
Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
Copilot stopped work on behalf of
JoshLove-msft due to an error
March 5, 2026 02:52
...nt-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs
Outdated
Show resolved
Hide resolved
...nt-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs
Outdated
Show resolved
Hide resolved
…ection per TCGC behavior Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
Restores the MetricsClientParams model and @clientInitialization parameters on the Metrics interface. Regenerated all generated libraries to validate the parameterized accessor behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
docs/samples/client/csharp/SampleService/SampleClient/src/Generated/SampleTypeSpecClient.cs
Show resolved
Hide resolved
Contributor
|
No changes needing a change description found. |
...nt-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs
Outdated
Show resolved
Hide resolved
…eneration Remove redundant IsApiVersion/IsEndpoint filters in accessor loop (already handled by earlier branches). Use _inputClient.Parameters instead of _allClientParameters for parent comparison. Retain parent comparison for correctness in MultiServiceClient scenarios where params are shared. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
jorgerangel-msft
approved these changes
Mar 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ClientProvider.cs:HasAccessorOnlyParameters()detects subclient-specific params;BuildFields()skips caching field;BuildMethods()generates parameterized accessorMetricsClientParamstoSampleService/main.tsp; regenerateSample-TypeSpecSampleService/main.tspGenerate.ps1and check in regenerated filesOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.