Swagger编辑器中的“映射条目缩进不良”错误是什么意思?

时间:2018-11-05 13:05:36

标签: swagger swagger-2.0 swagger-editor

我在下面的OpenAPI定义的Swagger编辑器中收到“映射条目缩进不良”错误。我已经尝试了前面提到的所有解决“缩进错误”的方法,但是它们似乎没有用。谁能告诉下面的代码怎么了?

      responses:
        '200':
          description: List all applicable errors for API
          headers:
            x-request-received-at:
              type: string
              description: A datetime stamp of when the request was received
            x-response-sent-at:
              type: string
              description: A datetime stamp of when the response was sent
          schema:
            $ref: '#/definitions/ErrorResponse'
        default:
          description: An unexpected error occurred
          schema:
            $ref: '#/definitions/Error'
   '/funeral/{contractReference}/agreement':
     get:
        summary: Get the funeral policy and debit order mandate agreement for the client to sign
        operationId: 
         - get801FuneralCoverPlanAgreementHtml
         - getAUTHORITYANDMANDATEFORPAYMENTINSTRUCTIONSHTML
        tags:
         - "FuneralCoverService"
         - "InternalAPI"
        parameters:
         - name: contractReference
        in: "path"
        required: true
        type: string
        description: "Unique contract reference linked to the quote and estimate prepared for the client which should be used as input to the agreements."
        maxLength: 80

Swagger Editor: bad indentation of mapping entry error

1 个答案:

答案 0 :(得分:1)

参数属性未对齐。所有属性都必须具有相同的缩进级别。

错误:

        parameters:
         - name: contractReference
        in: "path"
        required: true
        type: string
        description: "Unique contract reference linked to the quote and estimate prepared for the client which should be used as input to the agreements."
        maxLength: 80

正确:

        parameters:
         - name: contractReference
           in: "path"
           required: true
           type: string
           description: "Unique contract reference linked to the quote and estimate prepared for the client which should be used as input to the agreements."
           maxLength: 80