Skip to content
This repository was archived by the owner on Jul 6, 2026. It is now read-only.
This repository was archived by the owner on Jul 6, 2026. It is now read-only.

tsp, TCGC adoption, Handle optional content-type #2930

Description

@haolingdong-msft

Will need to modify codegen to support adding the javadoc to let user input content-type.
Link #2861 (comment)

Depends on TCGC issue: Azure/typespec-azure#1259

Currently in codegen we get content types from requests.protocol.http.mediaTypes. Not from the values of contentType constant.
We need to pay attention to is single optional content type and multiple optional content types cases.

model ImageRequest {
  @body body?: bytes;
  @header contentType?: "image/png";
}
  @post
  op upload(...ImageRequest): void;
model ImageRequest {
  @body body?: bytes;
  @header contentType?: "image/png" | "image/jpeg";
}
  @post
  op upload(...ImageRequest): void;

Tasks

  • Add optional content type to code-model
  • Support optional content type in codegen

TCGC dependency

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions