I think the key is exactly that, with some ambiguity. In the case of our services, there is no way someone can make a call that is received by the specific handler such that it can return a 404 after receiving the call. If you make a call to the service and get a 404, then you didn't get into the service. That makes it clear that the 404 annotation shouldn't be there. The 500 is probably ok, in retrospect. A call that got into the service could conceivably get a 500 response code back.
On Thu, May 24, 2018 at 1:18 AM, Francesco Tumanischvili <[email protected]> wrote: > Not sure what you mean, adding the annotations above means defining such > responses in the resolved OpenAPI spec; this obviously makes sense if the > underlying service is indeed producing such responses. > > > On Monday, 21 May 2018 18:56:26 UTC+2, David Karr wrote: >> >> I've been writing REST services for a long time, but I've never used >> Swagger before, although I've been aware of it. >> >> I'm coming into a new project that is using it, although perhaps not as >> well as it could. >> >> I see a bunch of operations that define api responses like this: >> >> @ApiResponse(code = 404, message = "Service not available"), >> @ApiResponse(code = 500, message = "Unexpected Runtime error") >> >> These are handled implicitly by the framework. The service implementation >> doesn't handle them at all. Is it reasonable for services to define these >> expected response codes when the service implementation itself would never >> produce them? > > -- > 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.
