简体   繁体   中英

How to solve error in yaml/swagger?

This is part of my yaml schema:

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?

The line with default: has an invalid indentation:

              '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.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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