Open pakrym opened 4 years ago
Seems to be related to the recent text/plain
change.
@allenjzhang @AlexanderSher Problem happening here: Spec where the issue is
Swagger 2.0 only lets you define the produce content type at the operation level(or global) but not per status code. In this case depending on the status code it returns a different type and can guess here its also returning the different content type
string
-> text/plain CloudError
-> application/jsonstring
-> text/plainNow for this scenario we could see multiple solutions:
Option 2 would basically move/tweak the current behavior from generator to m4
Problem is this would still not cover the scenario where an api could return different content type for the exact same status code. (e.g. application/json
or application/xml
) probably dependent on what accept code was sent.
Option 3 solve this but would require the generator to always first group the responses by statusCode. The code model isn't really designed for this to work well. We could change that but that would be a breaking change for all the generators.
Another one: https://github.com/Azure/autorest.csharp/issues/1605
I don't know if having two different content types under the same status code is a valid case. If it is, then we have to change it on the level of generator plugin. If it isn't, then probably we should throw an error.
M4 generates multiple responses with the same status code
For https://github.com/Azure/azure-rest-api-specs/blob/d9cf7c7ed3d674ebd482836e82b274014245ae67/specification/attestation/data-plane/readme.md
Operation PrepareToSet
cc @daviwil