use-application-json-content-type
@azure-tools/typespec-azure-resource-manager/use-application-json-content-typeARM operations must only use application/json content types in request and response bodies.
ARM operations must use application/json for request and response bodies. The rule checks the
resolved content types for every request and response body in an ARM provider namespace.
Using a consistent JSON representation keeps ARM APIs compatible with Azure tooling and gives generated SDKs a predictable serialization format.
Incorrect
Section titled “Incorrect”@armProviderNamespacenamespace Microsoft.Contoso;
model ExportRequest { format: string;}
@postop export(@header contentType: "text/plain", @body body: ExportRequest): { @statusCode statusCode: 200; @header contentType: "application/octet-stream"; @body content: bytes;};Correct
Section titled “Correct”@armProviderNamespacenamespace Microsoft.Contoso;
model ExportRequest { format: string;}
model ExportResponse { location: url;}
@postop export(@header contentType: "application/json", @body body: ExportRequest): { @statusCode statusCode: 200; @body result: ExportResponse;};LintDiff Equivalent
Section titled “LintDiff Equivalent”This rule corresponds to the Swagger validator rule
NonApplicationJsonType.