在我使用YAML编辑的招摇文件中.我打算使用GFM语法插入代码块,这是swagger根据本文档所期望的.
description: >-
Some description of the object here.
More Here. An example to for this is as follows:
```json
{
"Key": {
"name": "myName",
"id": 100
}
}
```
Run Code Online (Sandbox Code Playgroud)
然而,这并没有显示为格式化为JSON,而是所有最终都在这样的一行上:
Some description of the object here. More Here. An example to for this is as follows: ```json { "Key": { "name": "myName", "id": 100 } } ```
Run Code Online (Sandbox Code Playgroud)
这一切都以一行结束,因为你通过指定使用折叠样式块标量>(-用于剥离chomping指示符).
你想要使用的是一个文字样式块标量,其中保留了换行符和间距.您可能还想使用默认的剪辑选择(在JSON代码的末尾留下一个换行符):
description: |
Some description of the object here.
More Here. An example to for this is as follows:
```json
{
"Key": {
"name": "myName",
"id": 100
}
}
```
Run Code Online (Sandbox Code Playgroud)
(唯一的变化是在第一行>-至|)
| 归档时间: |
|
| 查看次数: |
2021 次 |
| 最近记录: |