Search code examples
jsonswagger-2.0github-flavored-markdown

New paragraph in Swagger description when using JSON


How can I create a new paragraph when writing a description in Swagger when using JSON?

I only find examples for YAML and when I simply create a new paragraph as I would with Markdown, the validation fails and the document does not render anymore.

What I want

The first paragraph describes the call.

Another paragraph gives additional information about the call.

What I tried but does not work

"description": "The first paragraph describes the call.

Another paragraph gives additional information about the call.",

Solution

  • JSON doesn't support literal multiline strings.

    Replacing line breaks with \n should work, e.g.:

    "description": "The first paragraph describes the call.\n\nAnother paragraph gives additional information about the call.",