You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for this case, the contentType is a union of application/json or text, but tcgc returns bytes as the default encoding
@get
getSchemaByVersion is Azure.Core.Foundations.Operation<
Azure.Core.Foundations.ItemKeysOf<Version>,
OkResponse & SchemaContent & SchemaContentType
>;
@doc("The content type for given schema. Each schema type has an associated content-type.")
model SchemaContentType {
@doc("The content type for given schema.")
@header("Content-Type")
contentType: SchemaContentTypeValues;
}
@doc("Content of the schema.")
model SchemaContent {
@body
@doc("String representation (UTF-8) of the schema.")
content: bytes;
}
union SchemaContentTypeValues {
avro: "application/json; serialization=Avro",
@added(ServiceApiVersions.V2022_10)
json: "application/json; serialization=json",
@added(ServiceApiVersions.V2022_10)
custom: "text/plain; charset=utf-8",
@added(ServiceApiVersions.V2023_07_01)
protobuf: "text/vnd.ms.protobuf",
}
After some investigation with @tadelesh offline, tcgc is using strict equal to "application/json" to set the default encoding as base64
for this case, the contentType is a union of application/json or text, but tcgc returns
bytes
as the default encodingAfter some investigation with @tadelesh offline, tcgc is using strict equal to "application/json" to set the default encoding as base64
typespec-azure/packages/typespec-client-generator-core/src/types.ts
Line 184 in 5506281
But, previously, we have an ask from client emitter side that suggests us to leverage the logic from dotnet Azure/autorest.typescript#2200 and fixed in https://github.com/Azure/autorest.typescript/pull/2258/files#diff-7dd8f9407e7839a21c48e98c9da493fa7da52885017e1df4dbf18a346b9933c8
I wonder if tcgc could also leverage this ?
The text was updated successfully, but these errors were encountered: