我试图在Swagger编辑器中获得多行文字(顺便说一下,这是一个很棒的工具!)).
post:
summary: Translate one or more identifiers
description: |
Translate one or more identifiers for one entity into the
identifiers of another entity. Translate one or more
identifiers for one entity into the identifiers of another entity.
consumes:
- application/json
字符串
我已经试过了|和>,具有不同的结尾(增加缩进与空行),以及我能想到的每一种方法,但它总是给出相同的错误:
YAML Syntax Error
Can not read a block mapping entry; a multiline key may not be an implicit
key at line 24, column 15: consumes: ^
型
我看到JS-YAML的bug,表明问题是结尾处的Windows风格的换行符,我知道HTML文本区域可以创建。这是我第一次真正使用YAML,所以是我做错了什么,还是Swagger编辑器中的一个bug?
5条答案
按热度按时间chy5wohz1#
我认为问题出在你的描述块上的文本开头的方式。它必须在说明右侧缩进一级:这里有一个对我有用的例子:
字符串
在我的实际代码中,描述只有三行。
oymdgrw72#
是压痕。应该是这样的:
字符串
dxpyg8gm3#
我想添加JSON方法。我在Swagger编辑器中使用纯JSON来避免双重语法的问题(学习、调试、解析web documentation等)。
字符串
出于某种原因,似乎需要双换行符
\n
,至少对于在Swagger编辑器上呈现的新行来说是这样。然而,当我将官方的Uber API YAML演示导出为JSON(File -> Download as JSON)时,生成的JSON只有一个换行符,其中演示了多行文字。真奇怪xzv2uavs4#
在我的例子中,它只是一个**/,我应该放在永久链接的开头,在我的类别中。md**:
字符串
rlcwz9us5#
在我的例子中,复制/粘贴一些在文本前面有制表符的文本使它“看起来”很好,但导致了这个错误