Preserve union variant docs in OpenAPI response descriptions - #11785
Open
Timothee Guerin (timotheeguerin) with Copilot wants to merge 3 commits into
Open
Preserve union variant docs in OpenAPI response descriptions#11785Timothee Guerin (timotheeguerin) with Copilot wants to merge 3 commits into
Timothee Guerin (timotheeguerin) with Copilot wants to merge 3 commits into
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. |
Copilot started work on behalf of
Timothee Guerin (timotheeguerin)
August 28, 2026 12:52
View session
Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix openapi emitter to respect return type variant doc in response
Preserve union variant docs in OpenAPI response descriptions
Aug 28, 2026
commit: |
Timothee Guerin (timotheeguerin)
marked this pull request as ready for review
August 31, 2026 18:18
Timothee Guerin (timotheeguerin)
requested review from
catalinaperalta,
iscai-msft,
Laurent Mazuel (lmazuel) and
Mark Cowlishaw (markcowl)
as code owners
August 31, 2026 18:18
Copilot started reviewing on behalf of
Timothee Guerin (timotheeguerin)
August 31, 2026 18:19
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes OpenAPI response description generation so that @doc applied to return-type union variants is preserved when unions are flattened into concrete HTTP responses (instead of falling back to generic status-code descriptions).
Changes:
- Propagate union variant documentation through
resolveResponseVariantsso each resolved response can carry the correct description. - Add an OpenAPI emitter regression test asserting variant-specific descriptions for distinct status codes across supported OpenAPI versions.
- Add a Chronus changelog entry for the behavioral fix in
@typespec/http.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/openapi3/test/response-descriptions.test.ts | Adds coverage that union variant @doc values become the emitted OpenAPI response descriptions. |
| packages/http/src/responses.ts | Preserves per-variant documentation while flattening response unions by threading variant @doc into the resolved description. |
| .chronus/changes/copilot-openapi-emitter-respect-return-type-doc-2026-7-28-13-0-55.md | Records the fix as a @typespec/http changelog entry. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
You can try these changes here
|
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.
OpenAPI response descriptions discarded
@docannotations on return-type union variants, falling back to generic status-code descriptions.Response resolution
Coverage
This emits
Pet CreatedandPet Acceptedfor the corresponding response descriptions.