fix(http-server-csharp): honor models-only output - #11907
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
commit: |
|
All changed packages have been documented.
Show changes
|
|
You can try these changes here
|
There was a problem hiding this comment.
🟢 Approval recommended
The changes correctly gate non-model outputs for output-type: models, avoid unnecessary canonicalization, and include targeted tests plus a valid .chronus fix entry.
Pull request overview
This PR updates the @typespec/http-server-csharp emitter to correctly honor the output-type: models option by suppressing non-model artifacts (controllers, operations, mocks, project files, and docs) while still emitting models plus required shared support code.
Changes:
- Gate controller/interface generation,
Program.cs, and documentation emission behind amodelsOnlycheck in the emitter entrypoint. - Add a
ServiceTypeResolutionOptionsflag to skip HTTP operation canonicalization when operation artifacts won’t be emitted. - Add/extend tests to verify models-only output behavior and that canonicalization is not invoked when disabled.
File summaries
| File | Description |
|---|---|
| packages/http-server-csharp/test/emitter.test.ts | Adds an integration-style emitter test asserting that output-type: models only emits models + required support files and skips controllers/ops/mocks/project/docs. |
| packages/http-server-csharp/src/service-resolution.ts | Introduces ServiceTypeResolutionOptions and conditionally skips operation canonicalization when configured. |
| packages/http-server-csharp/src/service-resolution.test.ts | Adds a unit test to validate canonicalization is skipped (and HttpCanonicalizer.canonicalize is not called) when disabled. |
| packages/http-server-csharp/src/emitter.tsx | Implements modelsOnly gating for operation/controller/program/docs emission and passes canonicalization option accordingly. |
| .chronus/changes/fix-csharp-models-only-output-2026-9-8.md | Adds a fix changelog entry for the user-visible behavior correction. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Models-only output still appears to include an ASP.NET-dependent action filter. The unconditional Even a simple Could we separate the |
There was a problem hiding this comment.
🟡 Changes recommended
Add explicit framework usings to HttpServiceException before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 9/11 changed files
- Comments generated: 1
- Review effort level: Lite
This pull request updates the
@typespec/http-server-csharpemitter to fully support theoutput-type: modelsoption, ensuring that only models and their required support files are emitted when this option is set. The implementation introduces a new option to control operation canonicalization, updates the emitter logic to honor the models-only output, and adds comprehensive tests to verify the new behavior.Enhancements to models-only output:
output-type: modelsoption and, when enabled, emits only models and essential support files, skipping controllers, operations, mocks, and project files. [1] [2] [3]Service type resolution improvements:
ServiceTypeResolutionOptionsinterface and updated theresolveServiceTypesfunction to accept acanonicalizeOperationsflag, allowing it to skip HTTP operation canonicalization when only models are being emitted. [1] [2] [3]Testing and validation:
output-type: modelsis set, only model files and required support files are generated, and no controllers, operations, mocks, or project files are emitted.Documentation: