[TCGC] Fix File type contentType/accept header inconsistencies#4030
Merged
iscai-msft merged 10 commits intomainfrom Mar 23, 2026
Merged
[TCGC] Fix File type contentType/accept header inconsistencies#4030iscai-msft merged 10 commits intomainfrom
iscai-msft merged 10 commits intomainfrom
Conversation
…erializedName for response headers, enum accept for multiple content types Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com>
Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix inconsistency in File support parameters and responses
[TCGC] Fix File type contentType/accept header inconsistencies
Mar 11, 2026
commit: |
…t accept header Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com> Agent-Logs-Url: https://github.com/Azure/typespec-azure/sessions/510fb20a-47fa-46c9-b0a3-ed52091ece89
Contributor
Author
Resolved — added test in |
tadelesh
reviewed
Mar 23, 2026
…tent type Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com> Agent-Logs-Url: https://github.com/Azure/typespec-azure/sessions/99a377b1-bd10-4d4d-9a9f-6f047bf02159
tadelesh
reviewed
Mar 23, 2026
Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com> Agent-Logs-Url: https://github.com/Azure/typespec-azure/sessions/725ace9d-fc57-4a06-a779-127f17121c65
…am/file for both contentType and accept Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com> Agent-Logs-Url: https://github.com/Azure/typespec-azure/sessions/725ace9d-fc57-4a06-a779-127f17121c65
tadelesh
reviewed
Mar 23, 2026
…File type branch for constant/enum Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com> Agent-Logs-Url: https://github.com/Azure/typespec-azure/sessions/e4a8a52d-745c-4d6d-9e9d-e47477ad5e1f
tadelesh
reviewed
Mar 23, 2026
.chronus/changes/fix-file-support-inconsistency-2026-03-11-03-12-00.md
Outdated
Show resolved
Hide resolved
Collaborator
|
All changed packages have been documented.
Show changes
|
Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com> Agent-Logs-Url: https://github.com/Azure/typespec-azure/sessions/8f9b3000-67de-4a91-a639-02c1c80eb033
Collaborator
|
You can try these changes here
|
iscai-msft
approved these changes
Mar 23, 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.
Three bugs in File type handling: (1)
contentTypeparam typed asstringinstead ofconstantfor File uploads with specific content types, (2) responsecontentTypeheader hasserializedName: undefined, (3)acceptparam isstringinstead of enum for multi-content-type downloads.Changes
createContentTypeOrAcceptHeader: The original content type/accept logic is preserved unchanged (json/text/octet-stream → constant for contentType; any single value → constant for accept). A newelse ifbranch is added specifically for File type bodies (bodyKind === "file"), which follows the File's content type constraints to create a constant (single content type) or anonymous enum (multiple content types) for bothcontentTypeandacceptparams. This cleanly separates File-specific handling from the general content type logic.serializedNamefallback: Added fallback ingetSdkHttpResponseAndExceptions— whengetHeaderFieldNamereturnsundefined(File'scontentTypePropertylacks@header), maps to"Content-Type"SdkEnumTypewith values instead of defaulting tostringOriginal prompt
Filesupport #3999💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.