Skip to content

Skip generating ClientSettings for internal clients#10086

Merged
JoshLove-msft merged 4 commits intomicrosoft:mainfrom
JoshLove-msft:jolov/fix-auth-policy-and-settings-accessibility
Mar 19, 2026
Merged

Skip generating ClientSettings for internal clients#10086
JoshLove-msft merged 4 commits intomicrosoft:mainfrom
JoshLove-msft:jolov/fix-auth-policy-and-settings-accessibility

Conversation

@JoshLove-msft
Copy link
Contributor

@JoshLove-msft JoshLove-msft commented Mar 19, 2026

When a client is internal (e.g., via customization), skip generating the \ClientSettings\ type entirely. There is no need to generate a public settings class for an internal client.

Changes

  • Added a \DeclarationModifiers.HasFlag(TypeSignatureModifiers.Public)\ check to the \ClientSettings\ initialization in \ClientProvider, so settings are only generated for public clients.

…for internal clients

Bug 1: When no auth is configured, the internal constructor accepted an
authenticationPolicy parameter but never included it in the pipeline
policies. Fixed by checking only authPolicyParam != null instead of
requiring authFields != null too.

Bug 2: When ClientOptions is internal, skip generating ClientSettings
entirely rather than generating a settings class with accessibility
mismatches.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@JoshLove-msft JoshLove-msft force-pushed the jolov/fix-auth-policy-and-settings-accessibility branch from c4ca659 to 360ee5c Compare March 19, 2026 15:59
@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 Mar 19, 2026
JoshLove-msft and others added 2 commits March 19, 2026 09:05
The client-level public check is sufficient; if the client is internal,
settings are already skipped.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@JoshLove-msft JoshLove-msft changed the title Fix authenticationPolicy not used in internal ctor and skip settings … Skip generating ClientSettings for internal clients Mar 19, 2026
Verify that ClientSettings is null when the client is customized to be
internal, in both CanChangeClientAccessibility and
CanChangeClientOptionsAccessibility tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@JoshLove-msft JoshLove-msft enabled auto-merge March 19, 2026 16:14
@JoshLove-msft JoshLove-msft added this pull request to the merge queue Mar 19, 2026
@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 19, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/http-client-csharp@10086

commit: 661af11

@github-actions
Copy link
Contributor

No changes needing a change description found.

Merged via the queue into microsoft:main with commit 389d0c0 Mar 19, 2026
25 checks passed
@JoshLove-msft JoshLove-msft deleted the jolov/fix-auth-policy-and-settings-accessibility branch March 19, 2026 18:30
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.

2 participants