Skip to content

Make ConfigurationSchema section name, options ref, and NuGet.targets generation configurable#10226

Merged
JoshLove-msft merged 3 commits into
microsoft:mainfrom
JoshLove-msft:fix/configurable-schema-options
Apr 1, 2026
Merged

Make ConfigurationSchema section name, options ref, and NuGet.targets generation configurable#10226
JoshLove-msft merged 3 commits into
microsoft:mainfrom
JoshLove-msft:fix/configurable-schema-options

Conversation

@JoshLove-msft
Copy link
Copy Markdown
Contributor

Overview

Add three settable properties to ScmCodeModelGenerator that allow downstream generators and plugins to customize the ConfigurationSchema.json output:

  • ConfigurationSchemaSectionName (default: "Clients") - Top-level section key
  • ConfigurationSchemaOptionsRef (default: "options") - Base options ref value
  • GenerateNuGetTargets (default: true) - Whether to emit the .NuGet.targets file

Motivation

Azure SDK generators need to use "AzureClients" instead of "Clients", reference "azureOptions" instead of "options", and suppress .NuGet.targets generation. These properties enable both AzureClientGenerator and GeneratorPlugin.Apply() to configure the behavior without overriding WriteAdditionalFiles.

Changes

  • ScmCodeModelGenerator.cs: Added three public settable properties, updated WriteAdditionalFiles to use them
  • No breaking changes - defaults preserve existing behavior
  • All 1283 existing ClientModel tests pass

… generation configurable

Add three settable properties to ScmCodeModelGenerator:
- ConfigurationSchemaSectionName: top-level section key (default: 'Clients')
- ConfigurationSchemaOptionsRef: base options \ value (default: 'options')
- GenerateNuGetTargets: whether to emit the .NuGet.targets file (default: true)

These properties allow downstream generators and plugins to customize the
ConfigurationSchema.json output without overriding WriteAdditionalFiles.
For example, Azure SDK generators can set 'AzureClients' and 'azureOptions'
and disable NuGet.targets generation (handled centrally by their build infra).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@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 Apr 1, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 1, 2026

Open in StackBlitz

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

commit: 359e6d7

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 1, 2026

No changes needing a change description found.

JoshLove-msft and others added 2 commits March 31, 2026 17:29
Move ConfigurationSchema-related properties into a dedicated
ConfigurationSchemaOptions class for cleaner API surface.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Test custom section name, custom options ref, combined usage, and
default values.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@JoshLove-msft JoshLove-msft enabled auto-merge April 1, 2026 03:14
@JoshLove-msft JoshLove-msft added this pull request to the merge queue Apr 1, 2026
Merged via the queue into microsoft:main with commit 0680ffb Apr 1, 2026
29 checks passed
@JoshLove-msft JoshLove-msft deleted the fix/configurable-schema-options branch April 1, 2026 16:14
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