Skip to content

Swagger Annotations @Schema larger description

I have a field with a larger description.

@Schema(description = "Lorem ipsum dolor sit ametn consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliquan Ut enim ad minim veniamn quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat")
@StringField(required = false)
private String myField;

In swagger-ui page, the description is inline. Is there any way to make “n” work when documenting the model?


The summary field is displayed as a single line because the summary text is inside of an element. Being an inline element, the span ignores n characters.

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

summary: An optional, string summary, intended to apply to all operations in this path.

description: An optional, string description, intended to apply to all operations in this path. CommonMark syntax MAY be used for rich text representation.

Markdown fields allow HTML (though we strip most HTML tags out in Swagger-UI, for protection against XSS attacks), but regular string fields do not, they're just displayed as-is.

Within Swagger-UI, we expect that your summary will only be one line since it was added to the OpenAPI specification with the intention of being a shorter version of an operation description. Allowing multi-line summaries would require us to rework our summary and operation UI, and IMO would go against the spirit of the summary and description fields.

Hopefully, this helps!