[Repo Assist] improve: add (returns) XmlDoc tag for operation response descriptions (+4 tests, 353→357)#420
Merged
sergey-tihon merged 3 commits intoMay 3, 2026
Conversation
… (+4 tests, 353->357) When a success response (2xx or default) has a description in the OpenAPI schema, surface it as a <returns> XML documentation tag on the generated operation method. Changes: - Utils.fs: extend buildXmlDoc to accept an optional returnDoc parameter and emit a <returns> tag when present - OperationCompiler.fs: extract okResponse as a top-level binding so its Description is available to the XmlDoc builder alongside retMimeAndTy - Schema.XmlDocTests.fs: add 4 tests covering returns tag presence/absence Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for emitting an XML documentation <returns> tag on generated operation methods when the selected “success” OpenAPI response includes a non-blank description. This improves parity between OpenAPI response descriptions and generated client method docs.
Changes:
- Extend
XmlDoc.buildXmlDocto accept areturnDocand emit<returns>...</returns>when present. - Refactor
OperationCompilerto computeokResponseonce, derivereturnDocfromokResponse.Value.Description, and pass it through tobuildXmlDoc. - Add tests covering presence/absence of the
<returns>tag in method XML doc output.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/SwaggerProvider.DesignTime/Utils.fs |
Adds returnDoc support to XML doc builder and emits <returns> when non-empty. |
src/SwaggerProvider.DesignTime/OperationCompiler.fs |
Hoists okResponse and threads response description into method XmlDoc generation. |
tests/SwaggerProvider.Tests/Schema.XmlDocTests.fs |
Adds new unit tests validating <returns> tag behavior for operation methods. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This was referenced May 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 This PR was created by Repo Assist, an automated AI assistant.
Summary
Generated operation methods now include a
<returns>XML documentation tag when the success response has a description in the OpenAPI schema. Previously,buildXmlDocemitted<summary>,<remarks>, and<param>tags but silently dropped the response description.Root cause
XmlDoc.buildXmlDocinUtils.fshad noreturnDocparameter, so the response description was never surfaced. TheokResponsevalue was also scoped inside theretMimeAndTybinding, making it unavailable to the later XmlDoc builder.Changes
Utils.fsbuildXmlDocwith an optionalreturnDoc : string optionparameter; emit<returns>...</returns>when presentOperationCompiler.fsokResponsefrom insideretMimeAndTyto a top-level binding; derivereturnDocfromokResponse.Value.Descriptionand pass it tobuildXmlDocSchema.XmlDocTests.fsBefore / After
OpenAPI schema:
Before:
<summary>List all items</summary>After:
<summary>List all items</summary><returns>A list of items</returns>Trade-offs
None — the change is additive. The
returnDocparameter defaults toNonein all other paths, so the XmlDoc is unchanged for operations without a response description.Test Status
✅ Build succeeded
✅ 357 unit tests pass (was 353; +4 new tests for
<returns>tag behaviour)✅ Fantomas format check passes