3

这是我的 yaml 架构的一部分:

paths:
  '/testing/all':
    get:
            summary: Get list of open items
            tags:
              - Items
            description: |
              Returns an array of json objects items
            responses:
              '200':
                    description: Array of open items
                    schema:
                        type: array
                        $ref: '#/definitions/itemList'
                default:
                    description: Unexpected error
                    schema:
                        $ref: '#/definitions/Error'

我知道缩进,但在包含“响应”的行上仍然存在错误:

YAMLException: can not read a block mapping entry; a multiline key may not be an implicit key at line 20, column 13:
                        responses:

我使用 webstorm 2016 和 windows 7 如何解决这个错误?

4

1 回答 1

3

带有default:无效缩进的行:

              '200':
\------------/
  14 spaces
              [...]
                default:
\--------------/
   16 spaces

块映射中每个隐式键的缩进必须与其他键的缩进匹配。

(错误消息表明该responses:行有问题,但实际上是有效的 YAML。如果在您修复我解释的错误时消息没有消失,那可能是您使用的 YAML 实现的错误,您应该举报。)

于 2016-06-18T08:32:05.670 回答