I have a REST service method annotated with
io.swagger.annotations.ApiOperation
@ApiOperation(value = "some string")
I need some string
to generate newlines in the HTML page swagger-ui.html
(i.e. in the Swagger UI page where I see my docs and I can test my API methods).
I tried putting <br/>
and n
in some string
, and anything I could think of,
and anything I could find as suggestions here on SO… but nothing works.
Any ideas? Or is it just not possible?
I see the project uses Swagger 1.5.20 JARs.
That version I cannot change.
swagger-annotations-1.5.20.jar
swagger-models-1.5.20.jar
Advertisement
Answer
I am afraid that you cannot put line breaks into the summary field as opposed to description field. Check the comment from a member of Swagger team: Swagger UI ignores line breaks in description
The
summary
field is displayed as a single line because the summary text is inside of a<span>
element. Being an inline element, the span ignoresn
characters.Further, your
<br>
is not showing up because thesummary
field is a simple string field, as opposed todescription
, which is a Markdown field …