2017-02-20 80 views
1

如何在使用JSON編寫Swagger中的描述時創建新段落?使用JSON時Swagger描述中的新段落

我只找到YAML的例子,當我像Markdown一樣簡單創建一個新段落時,驗證失敗,文檔不再呈現。

我想

什麼第一段描述了電話。

另一段提供了有關該呼叫的其他信息。

我試過,但不起作用

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

Another paragraph gives additional information about the call.", 

回答

2

JSON不支持文字多行字符串。

更換符合\n突破應該工作,例如:

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

只嘗試一個'\ N'它不具有任何影響,放棄了。 – mrplow

+1

@mrplow,這會給你一個換行符,但由於描述字段使用GitHub格式化Flavored Markdown段落必須用空行分隔,因此第二個'\ n'。 – Chris