feat(http-server-csharp): added include-operations-controller option to skip generating operations controller - #11495
Conversation
|
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. |
exclude-interfaces option to skip controller generation
| - "@typespec/http-server-csharp" | ||
| --- | ||
|
|
||
| Add `exclude-interfaces` emitter option to skip controller and business-logic interface generation for specified TypeSpec interfaces. |
There was a problem hiding this comment.
@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
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
NOTE: this is a breaking change
Co-authored-by: abatishchev <351644+abatishchev@users.noreply.github.com>
…rations-controller boolean option Co-authored-by: abatishchev <351644+abatishchev@users.noreply.github.com>
efb5bc7 to
a0cdc89
Compare
exclude-interfaces option to skip controller generationinclude-operations-controller option to skip generating operations controller
commit: |
|
All changed packages have been documented.
Show changes
|
There was a problem hiding this comment.
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
|
You can try these changes here
|
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
exclude-interfaces(string[]) inlib.ts— lists TypeSpec interface names to skip during generationemitter.tsx— filters resolved interfaces against the exclusion set before passing toControllersAndInterfaces,MockImplementations, and mock registration helpers; excluded interfaces produce no*Controller.csorI*.csfilestest/exclude-interfaces.test.tscovers single exclusion, multi-exclusion, no-op exclusion, and baseline (no exclusions)featureentry for@typespec/http-server-csharpUsage
With the above config,
OperationsController.csandIOperations.csare not emitted; all other interfaces are unaffected.