【问题标题】:Parser error "bad indentation of a mapping entry" in Swagger EditorSwagger 编辑器中的解析器错误“映射条目的缩进错误”
【发布时间】:2018-02-17 17:48:01
【问题描述】:

在下面的 OpenAPI 定义中,参数定义导致解析器错误“bad indentation of a mapping entry”。怎么了?

paths:
  /users/{username}:
    get:
      tags:
        - users
      summary: "Get the users profile"
      parameters:
       -in: path
        name: username  
        description: "get user by name"
        type: string
        required: true
      responses:
        200:
          description: OK
          schema:
            $ref: "#/definitions/users"

【问题讨论】:

    标签: swagger swagger-ui swagger-2.0


    【解决方案1】:

    在 YAML 序列(列表)中,- 指示符后需要空格。你需要更换

    -in: path
    

    - in: path
    

    (并适当地对齐后续关键字)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-04-08
      • 1970-01-01
      • 2022-01-21
      • 1970-01-01
      • 1970-01-01
      • 2017-06-14
      • 1970-01-01
      • 2018-12-31
      相关资源
      最近更新 更多