Skip to content

type-not-supported-on-text-plain

Id
@azure-tools/typespec-java/type-not-supported-on-text-plain

Severity: warning

This diagnostic is issued when an operation uses an enum request or response body with text/plain.

The emitter substitutes String for the unsupported Java type on the request or response body.

enum Color {
red,
blue,
}
@post
op setColor(@header contentType: "text/plain", @body color: Color): void;
Complex SDK type is not supported for "text/plain" content-type. Emitter would use string type on 'setColor' request body.

Use string for a text payload, or use a structured content type such as application/json when the SDK type should remain strongly typed.

@post
op setColor(@header contentType: "text/plain", @body color: string): void;

Suppress the warning only when the generated String API is the intended contract.