Emit XML doc comments from schema descriptions in C# codegen#724
Emit XML doc comments from schema descriptions in C# codegen#724stephentoub merged 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the C# code generator to emit XML doc comments (/// <summary>...</summary>) for generated .NET SDK types/members based on JSON Schema description, improving IntelliSense documentation for consumers.
Changes:
- Added XML doc comment helpers to the C# generator (escaping, punctuation normalization, fallback summaries/remarks).
- Emitted doc comments across generated Session Events and RPC types (including
<inheritdoc />on discriminator overrides). - Refreshed generated
SessionEvents.csandRpc.csoutputs to include the new documentation.
Reviewed changes
Copilot reviewed 1 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| scripts/codegen/csharp.ts | Adds XML doc emission utilities and threads schema description through session-event / RPC codegen paths. |
| dotnet/src/Generated/SessionEvents.cs | Regenerated session event models with XML doc comments on types and members. |
| dotnet/src/Generated/Rpc.cs | Regenerated RPC request/response models and API wrappers with XML doc comments and punctuation normalization. |
SDK Consistency Review ✅I've reviewed this PR for cross-SDK consistency and can confirm that this change improves consistency across all four SDK implementations. Documentation Generation StatusBefore this PR:
After this PR:
AnalysisThis PR brings the .NET SDK into feature parity with the other three SDK implementations. All four languages now provide IntelliSense/IDE documentation for consumers, which is a core developer experience feature. The implementation follows .NET conventions (XML doc comments with Recommendation: This PR maintains and improves cross-SDK consistency. No changes needed in other SDKs. ✨
|
Update the C# code generator (csharp.ts) to emit /// <summary> XML doc comments on all generated types and members, sourced from JSON Schema description annotations. Changes to scripts/codegen/csharp.ts: - Add escapeXml(), ensureTrailingPunctuation(), xmlDocComment(), rawXmlDocSummary(), and xmlDocCommentWithFallback() helpers - Emit <summary> on all data classes, nested classes, polymorphic base and derived classes, enum types, and enum members - Emit <remarks> with event name on SessionEvent-derived classes when a real schema description is present - Emit <inheritdoc /> on all override string Type properties - Emit <see cref> cross-references in data class fallback summaries - Use <c> tags for event names and discriminator values - Ensure all comments end with sentence-ending punctuation - Add synthetic fallback summaries for types without schema descriptions - Apply XML escaping to schema-sourced text; skip escaping for codegen-controlled XML tags Regenerated output (from published @github/copilot v1.0.2 schemas): - SessionEvents.cs: ~525 <summary> + 69 <inheritdoc> comments - Rpc.cs: class-level and property-level docs with fallbacks Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2bd43e7 to
e25dfe8
Compare
✅ Cross-SDK Consistency ReviewThis PR improves cross-SDK consistency by adding comprehensive XML documentation to the .NET SDK, bringing it into parity with the other three language implementations. Documentation Status Across All SDKs
What This PR AchievesBefore: C# generated code had minimal documentation (only base class summary, partial RPC property docs) After: C# now has comprehensive XML doc comments:
This matches the documentation coverage already provided by TypeScript's JSDoc, Python's docstrings, and Go's comments. No consistency gaps introduced — this PR closes a documentation gap that existed in C# relative to the other SDKs. RecommendationApprove ✨ — This change maintains and improves cross-SDK consistency by ensuring all four language implementations provide equivalent IDE documentation support to their users.
|
Summary
Updates the C# code generator to emit
/// <summary>\ XML doc comments on all generated types and members, sourced from JSON Schema \description\ annotations. This enables IntelliSense documentation for .NET SDK consumers.Changes
\scripts/codegen/csharp.ts\
awXmlDocSummary(), \xmlDocCommentWithFallback()\
Generated output (from published @github/copilot\ v1.0.2)
Notes