Skip to content

feat(http-server-csharp): added include-operations-controller option to skip generating operations controller - #11495

Open
abatishchev with Copilot wants to merge 2 commits into
mainfrom
copilot/featurehttp-server-csharp-disable-operations-contr
Open

feat(http-server-csharp): added include-operations-controller option to skip generating operations controller#11495
abatishchev with Copilot wants to merge 2 commits into
mainfrom
copilot/featurehttp-server-csharp-disable-operations-contr

Conversation

Copilot AI commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

RPaaS and similar hosting platforms handle certain endpoints (e.g., ARM Operations) automatically, making the generated controller and business-logic interface files unnecessary noise.

Changes

  • New emitter option exclude-interfaces (string[]) in lib.ts — lists TypeSpec interface names to skip during generation
  • emitter.tsx — filters resolved interfaces against the exclusion set before passing to ControllersAndInterfaces, MockImplementations, and mock registration helpers; excluded interfaces produce no *Controller.cs or I*.cs files
  • Teststest/exclude-interfaces.test.ts covers single exclusion, multi-exclusion, no-op exclusion, and baseline (no exclusions)
  • Changelogfeature entry for @typespec/http-server-csharp

Usage

# tspconfig.yaml
options:
  "@typespec/http-server-csharp":
    exclude-interfaces:
      - Operations

With the above config, OperationsController.cs and IOperations.cs are not emitted; all other interfaces are unaffected.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
1 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI changed the title [WIP] Add configuration to disable generating Operations controller feat(http-server-csharp): add exclude-interfaces option to skip controller generation Jul 30, 2026
Copilot AI requested a review from abatishchev July 30, 2026 18:17
- "@typespec/http-server-csharp"
---

Add `exclude-interfaces` emitter option to skip controller and business-logic interface generation for specified TypeSpec interfaces.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@copilot why it's exclude-interfaces The issue is about Operations controller. Hence the key should be called include-operations-controller of type boolean: include if true, otherwise don't. Default it to false

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Replaced exclude-interfaces with include-operations-controller: boolean (default false). When false (default), the controller and interface for any TypeSpec interface named exactly Operations are not generated. Set to true to include them.

Committed in the latest push.

"include-operations-controller": {
type: "boolean",
nullable: true,
default: false,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

NOTE: this is a breaking change

Copilot AI and others added 2 commits July 31, 2026 10:10
Co-authored-by: abatishchev <351644+abatishchev@users.noreply.github.com>
…rations-controller boolean option

Co-authored-by: abatishchev <351644+abatishchev@users.noreply.github.com>
@abatishchev
abatishchev force-pushed the copilot/featurehttp-server-csharp-disable-operations-contr branch from efb5bc7 to a0cdc89 Compare July 31, 2026 17:10
@abatishchev abatishchev changed the title feat(http-server-csharp): add exclude-interfaces option to skip controller generation feat(http-server-csharp): added include-operations-controller option to skip generating operations controller Jul 31, 2026
@pkg-pr-new

pkg-pr-new Bot commented Jul 31, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/http-server-csharp@11495

commit: a0cdc89

@github-actions

Copy link
Copy Markdown
Contributor

All changed packages have been documented.

  • @typespec/http-server-csharp
Show changes

@typespec/http-server-csharp - feature ✏️

Add include-operations-controller emitter option (boolean, default false) to control whether a controller and business-logic interface are generated for the ARM Operations endpoint. Set to true to include the Operations controller.,> ,> yaml,> # tspconfig.yaml,> options:,> "@typespec/http-server-csharp":,> include-operations-controller: true,>

@abatishchev
abatishchev marked this pull request as ready for review July 31, 2026 17:15

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this is too azure specific, this emitter shouldn't have any reference to azure in its options and handling of things.
I think we might be better of having a generic omit-types: string[] option which lets you exclude any types from being generated. This is still not ideal as this really should be defined with decorators but this is not something we'll have soon so this can unblock in the meantime

@azure-sdk-automation

Copy link
Copy Markdown

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature request] http-server-csharp: Configuration key to turn of generating Operations controller

3 participants