Swagger:同一路径下的多个动词在编辑器中验证,但阻止它重新启动



我在下面有大摇大摆的定义。 编辑器对其进行验证,PUT和PATCH都显示在预览窗口中。

但是,如果我停止编辑器并尝试重新启动它,我会得到:
错误:
{ [YAMLException: duplicated mapping key at line 128, column 53: ... -controller: messagesPatchOrSend

第 128 行是"补丁:"正上方的行:

亚姆:

    paths:
      /messages/{messageId}:
        x-swagger-router-controller: messagesUpdateOrSend
        put:
          summary: Update/send a message
          description: The `PUT` method should be used where it is desireable to submitting every property whether it changed or not (as opposed to updating discrete properties of a message).  This endpoint MUST NOT be called if a `messageId` is not available. If `send=false` the message MUST be saved as a draft, otherwise the message MUST be marked for delivery.
          operationId: messagesUpdateOrSend
          consumes: ["application/json"]
          produces: ["application/json"]
          parameters:
            - name: messageId
              in: path
              description: A UID used by the proxy to uniquely identify the message.
              required: true
              type: string
            - name: send
              in: query
              description: Send message if `query=true`, save as draft if `query=false`
              required: true
              type: boolean
            - name: token
              in: query
              description: auth token, if not included in header.  Example `token=[Token]`
              required: false
              type: string
            - name: body
              in: body
              description: ""
              required: true
              schema:
                type: object
          responses:
            "200":
              description: Success/OK
              schema:
                $ref: "#/definitions/SuccessResponse"
            default:
              description: Error
              schema:
                $ref: "#/definitions/ErrorResponse"
        x-swagger-router-controller: messagesPatchOrSend
        patch:
          summary: Update/send a message
          description: ""
          operationId: messagesPatchOrSend
          consumes: ["application/json"]
          produces: ["application/json"]
          parameters:
            - name: messageId
              in: path
              required: true
              type: string
            - name: send
              in: query
              required: true
              type: boolean
            - name: token
              in: query
              required: false
              type: string
            - name: body
              in: body
              required: true
              schema:
                type: object
          responses:
            "200":
              description: Success/OK
              schema:
                $ref: "#/definitions/SuccessResponse"
            default:
              description: Error
              schema:
                $ref: "#/definitions/ErrorResponse"
        x-swagger-router-controller: messagesDelete
definitions:
  SuccessResponse:
    required:
      - message
    properties:
      message:
        type: string

  ErrorResponse:
    required:
      - message
    properties:
      message:
        type: string

这是因为您/messages/{messageId}:内部有两个x-swagger-router-controller值。

相关内容

  • 没有找到相关文章

最新更新