简体   繁体   English

如何解决 yaml/swagger 中的错误?

[英]How to solve error in yaml/swagger?

This is part of my yaml schema:这是我的 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'

I am aware of the indentation but still there is an error on the line which contains 'responses':我知道缩进,但在包含“响应”的行上仍然存在错误:

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

How can I fix this error, I am using webstorm 2016 and windows 7?我正在使用 webstorm 2016 和 windows 7,如何修复这个错误?

The line with default: has an invalid indentation:带有default:的行有一个无效的缩进:

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

The indentation of each implicit key in a block mapping must match the indentation of the other keys.块映射中每个隐式键的缩进必须与其他键的缩进匹配。

(The error message indicates that there is something wrong with the responses: line, but that one is actually valid YAML. If the message does not go away when you fix the error I explained, that is likely a bug of the YAML implementation you use and you should report it.) (错误消息表明responses:行,但实际上是有效的 YAML。如果修复我解释的错误后消息没有消失,那可能是您使用的 YAML 实现的错误你应该报告它。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM