SwaggerUI/YAML - 映射条目的缩进错误:找不到原因

SwaggerUI/YAML - bad indentation of a mapping entry : unable to find a reason

我在 Swagger UI 问题上停留了一个多小时,搜索文档和各种帖子以找到我似乎找不到的解释。

这是我的 YAML 文件的一部分:

paths:
  /projects:
    get:
      tags:
      - projects
      summary: Get projects
      description: 
      operationId: getProjects
      responses:
        200:
          description: successful operation
          schema:
            type: array
            items:
              $ref: "#/definitions/Project"
      security:
      - api_key: []

给我以下内容:

Parser error : bad indentation of a mapping entry (line 37)

第 37 行是 security:

困扰我的是在那之后我还有其他相同的 "code" 出现,唯一变化的因素是 $ref 的内容,没有在 [=15] 中产生任何错误=].

  1. 路径必须以 / 开头:/projects.

  2. description 需要一个值 - 至少是一个空字符串 "".