Conversation
…n multipart body Co-authored-by: baywet <7905502+baywet@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix OpenAPI emitter fails on union with bytes for multipart
fix(openapi3): resolve "Duplicate type name" error for named union with bytes in multipart body
Mar 16, 2026
baywet
approved these changes
Mar 16, 2026
commit: |
Collaborator
|
You can try these changes here
|
timotheeguerin
approved these changes
Mar 16, 2026
Member
|
@copilot run the formatting command, commit the changed files, do nothing else |
Co-authored-by: baywet <7905502+baywet@users.noreply.github.com>
Contributor
Author
Done in 7019add. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
timotheeguerin
approved these changes
Mar 16, 2026
Copilot AI
added a commit
that referenced
this pull request
Mar 16, 2026
…th bytes in multipart body (#10046) - [x] Analyze root cause of "Duplicate type name" error for multipart union with bytes - [x] Fix `addUsagesInOperation` in `visibility-usage.ts` to traverse multipart body part types - [x] Add test case for union with bytes in multipart body - [x] Add changelog entry - [x] Build and test changes (all 2482 tests pass) - [x] Apply prettier formatting <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> > > ---- > > *This section details on the original issue you should resolve* > > <issue_title>OpenAPI emitter fails on union with bytes for multipart</issue_title> > <issue_description>The following definition > > ```tsp > import "@typespec/http"; > using Http; > > union CreateVideoMultipartBodyInputReference { > bytes, > ImageRefParam, > } > union ImageRefParam { > { > @maxlength(20971520) > image_url: url, > }, > { > file_id: string, > }, > } > model CreateVideoMultipartBody { > > input_reference?: HttpPart<CreateVideoMultipartBodyInputReference>; > } > > op createVideo( > @Header > contentType: "multipart/form-data", > > @multipartBody > body: CreateVideoMultipartBody, > ): void; > ``` > > Fails with this error message : Duplicate type name: 'CreateVideoMultipartBodyInputReference'. Check @FriendlyName decorators and overlap with types in TypeSpec or service namespace. > > Interestingly, if we replace bytes by string or something else, the emission starts working. I'd expect it to work with bytes as well. > </issue_description> > > ## Comments on the Issue (you are @copilot in this section) > > <comments> > </comments> > </details> <!-- START COPILOT CODING AGENT SUFFIX --> - Fixes #10045 <!-- START COPILOT CODING AGENT TIPS --> --- 💬 Send tasks to Copilot coding agent from [Slack](https://gh.io/cca-slack-docs) and [Teams](https://gh.io/cca-teams-docs) to turn conversations into code. Copilot posts an update in your thread when it's finished. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: baywet <7905502+baywet@users.noreply.github.com>
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.
addUsagesInOperationinvisibility-usage.tsto traverse multipart body part typesOriginal prompt
💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.