swagger-core icon indicating copy to clipboard operation
swagger-core copied to clipboard

Can't reference javax.ws.rs.core.Response.Status enum in @ApiResponse.responseCode

Open tomq42 opened this issue 6 years ago • 1 comments

@ApiResponse.responseCode is a String. It seems like I am supposed to write a string literal containing the response code, such as "400", "402" etc. I can't remember the numeric status codes. The implementation of the method references the Jax-RS javax.ws.rs.core.Response.Status when it needs a response code. It seems a shame that I either have to use a string literal magic constant or define my own set of constants somewhere. I can't use the constants on HttpServletResponse, as they are defined as ints. I need a constant expression so I can't call Integer.toString etc on anything. Whilst the spec defines this as a string, so responseCode needs to be a string, providing a second property that you can set to a Status value would seem sensible?

tomq42 avatar Jan 28 '19 08:01 tomq42

I support this it is java

sysmat avatar Jul 10 '25 07:07 sysmat