Hi Axel,
So you know how it is, when a client sends an HTTP request it says “I’m sending you this media type and I expect you to send me that one!”, and then you say “well, okay, I’ll send you your requested media type when it’s a successful reply, but if it’s an error, all options are free!” – it’s, well, potentially a problem. But in some cases you gotta do what you gotta do right? So in the current version of the spec, you can’t really go ahead and define that the media type for 200 is this and for 400 is that. I think we’re covering this in the next version of the spec, or rather there is a proposal for that. As a workaround for now, you can pretty much say that the operation produces both media types and go with that. From: <[email protected]> on behalf of Axel Bonnet <[email protected]> Reply-To: "[email protected]" <[email protected]> Date: Thursday, 4 August 2016 at 10:44 To: Swagger <[email protected]> Subject: Different response format in case of error Hello, I'm specifying an API with swagger and I have an operation that return plain text when it's OK, and json when there is an error. I can't find how to express that with swagger. Should I say that the path produces "application/json" and "text/plain" ? Doesn't it mean that the user could expect a json response even if it's OK ? On one hand, it is logical that the method return some plain text, on the other, it looks logical to return json on any error to be consistent with the rest of the API. So i don't know what to do. Thanks for any help ! Axel -- You received this message because you are subscribed to the Google Groups "Swagger" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Swagger" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
