How to make Swagger put new line in the generated HTML (in Swagger UI page)?

Tags: , , , ,

I have a REST service method annotated with

@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.



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 ignores n characters.

Further, your <br> is not showing up because the summary field is a simple string field, as opposed to description, which is a Markdown field …

Source: stackoverflow