Repository navigation
Fix default file upload Content-Type - #5306
Merged
iscai-msft merged 6 commits intoAug 27, 2026
Merged
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6a785543-019d-4b0c-9750-5affcfc900ee
iscai-msft
requested review from
Laurent Mazuel (lmazuel),
m-nash,
Mark Cowlishaw (markcowl),
Timothee Guerin (timotheeguerin) and
Jeff Fisher (xirzec)
as code owners
August 25, 2026 19:10
Contributor
|
All changed packages have been documented.
Show changes
|
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6a785543-019d-4b0c-9750-5affcfc900ee
commit: |
Contributor
📦 Package size report✅ No notable package size changes compared to the base branch. 13 package(s) with no notable change
Packed = gzipped |
Contributor
|
You can try these changes here
|
Content-Type header/param doc string embedded the raw contentTypes array, which for the default File case is ["*/*"]. Since that parameter is now surfaced to clients (no longer a hidden constant), downstream generators (e.g. Java) emit this doc text inside a /** ... */ block comment, where the literal */ prematurely closes the comment and corrupts the generated file. Omit the unconstrained */* marker from the doc text. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6a785543-019d-4b0c-9750-5affcfc900ee
Chenjie Shi (tadelesh)
approved these changes
Aug 26, 2026
…Java emitter instead The */* content-type doc filtering was a workaround. The actual bug is in the Java emitter (microsoft/typespec, packages/http-client-java), where parameter descriptions are XML-escaped but not comment-escaped before being written into Javadoc, so a literal */ can prematurely close a generated /** ... */ block. That fix will be made directly in microsoft/typespec; this PR keeps the TCGC-side doc string unfiltered. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6a785543-019d-4b0c-9750-5affcfc900ee
Jorge Rangel (jorgerangel-msft)
approved these changes
Aug 26, 2026
Weidong Xu (weidongxu-microsoft)
approved these changes
Aug 26, 2026
om singhal (Om-singhaI)
pushed a commit
to Om-singhaI/typespec
that referenced
this pull request
Aug 27, 2026
…osoft#11766) ## Summary Fixes generated Java code corruption when a Javadoc table cell (parameter name/type/description, or response header name/type/description) contains a literal `*/` sequence. ## Root cause Values written into the optional-parameters and response-headers Javadoc tables are escaped for XML special characters via `CodeNamer.escapeXmlComment`, but never comment-escaped. When a value embeds `*/` (for example, TCGC's Content-Type parameter doc for an unconstrained `Http.File` content type, whose `contentTypes` array is `["*/*"]`), the literal `*/` prematurely closes the surrounding generated `/** ... */` Javadoc block. This corrupts the rest of the generated Java file and breaks compilation with a long cascade of parser errors. ## Fix `CodeNamer.escapeComment` already exists and correctly escapes `*/` to `*µsoft#47;`, but it wasn't applied consistently. This change centralizes the escaping in the shared `ClientMethodTemplateBase#javadocTable` helper so every cell value (not just parameter descriptions) is protected, alongside the existing XML escaping. ## Context Found while fixing Azure/typespec-azure#5288 (Azure/typespec-azure#5306), where making the Content-Type parameter for default `Http.File` bodies client-visible (previously hidden as a constant) surfaced this latent Javadoc-escaping bug in CI. --------- Co-authored-by: iscai-msft <isabellavcai@gmail.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6a785543-019d-4b0c-9750-5affcfc900ee
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.
Fixes #5288
Summary
*/*from@typespec/httpas the unconstrainedFilecontent-type marker, not a concrete requestContent-Typevalue.Content-Typeas an optional string with client defaultapplication/octet-stream.Accept: */*behavior unchanged.Validation
mise exec -- pnpm exec oxlint packages/typespec-client-generator-core/src/http.ts packages/typespec-client-generator-core/test/methods/file.test.ts --deny-warningsmise exec -- pnpm --filter @azure-tools/typespec-client-generator-core test -- methods/file.test.ts(blocked locally: this worktree has an unavailable/brokencoresubmodule, so package imports from@typespec/*and@azure-tools/typespec-azure-corecould not resolve)