autorest
autorest copied to clipboard
[openapi to tsp] Fix `accept` header logic
Given the following swagger definition:
"produces": [
"application/vnd.microsoft.appconfig.kv+json",
"application/problem+json"
],
The converter outputs the following typespec code where all of the supported content types are bundled into 1 string:
accept: "application/vnd.microsoft.appconfig.kv+json, application/problem+json";
The correct code should represent each content type individually:
accept: "application/vnd.microsoft.appconfig.kv+json" | "application/problem+json";
cc @joheredi
@catalinaperalta could you show me the full swagger so that I could know which template we should use for this operation. I assume it might be ResourceRead, which seems lack of ability to override the content type. So I'm going to ask TSP team. Before that I need to know the full story.
This spec was converted to typespec a few months ago so you'll have to look at an older version of the swagger, linking it here: https://github.com/Azure/azure-rest-api-specs/blob/c1af3ab8e803da2f40fc90217a6d023bc13b677f/specification/appconfiguration/data-plane/Microsoft.AppConfiguration/stable/2023-11-01/appconfiguration.json
IIRC you'll be able to see that there are several operations with multiple produces statements it wasnt just a 1 time occurrence in the converted code.