【问题标题】:What does the "bad indentation of mapping entry" error mean in Swagger Editor?Swagger 编辑器中的“映射条目缩进错误”错误是什么意思?
【发布时间】:2019-04-08 20:23:40
【问题描述】:

我在以下 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 openapi swagger-2.0 swagger-editor


    【解决方案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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-06-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-31
      • 2018-12-30
      • 1970-01-01
      相关资源
      最近更新 更多