lbvirgo lbvirgo - 15 days ago 8
JSON Question

Is there a way to hardcode "response" in @ApiResponse annotation of swagger?

I've the below Swagger annotation for one of my api methods:

@ApiResponse(code = 200, message = "OK", response = String.class)


Is there a way I can hard-code the
response
?

I'm NOT keeping any domain objects in my service; my service is a kind-of wrapper service that connects with a third party vendor service and returns the json as-it-is to the caller.
So, is there a way I can hardcode the json schema in the
response
element ?

I know that if I define a domain object and mention its
.class
, I'll get the json schema in the output but as I mentioned I need to find a way without defining a domain object.

Also providing the hardocded json schema in
message
attribute will not make sense as because, I believe, this attribute is more for describing the status
code
, correct ?

Thanks to provide any pointers/suggestions.

Answer

I got few suggestions on other forum.

https://github.com/springfox/springfox/issues/1574