YAMLSyntaxError:所有集合项必须从同一列开始

问题描述 投票:0回答:1

我在 Express.js 路由中遇到一些 swagger 配置问题。我正在使用 'swagger-jsdoc''swagger-ui-express' 在我的代码中制作文档,并可以通过 '/docs' 路径访问它

此代码位于我的路线底部:


/**
 * @swagger
 * /table/join:
 *    post:
 *      summary: Join table
 *      requestBody:
 *        description: Table and user uuids
 *        required: true
 *        content:
 *          application/json:
 *            schema:
 *              type: object
 *              properties:
 *                user_id:
 *                  type: string
 *                table_uuid:
 *                  type: string
 *      tags:
 *        - Table
 *      responses:
 *        "200":
 *          description: Your table created successfully.
 *          content:
 *              application/json:
 *                  schema:
 *                      type: object
 *                      properties:
 *                          resultMessage:
 *                              $ref: '#/components/schemas/ResultMessage'
 *                          resultCode:
 *                              $ref: '#/components/schemas/ResultCode'
 *                          uuid:
 *                              type: string
 *       "400":
 *          description: Please provide all the required fields!
 *          content:
 *              application/json:
 *                  schema:
 *                      $ref: '#/components/schemas/Result'
 *       "500":
 *          description: An internal server error occurred, please try again.
 *          content:
 *              application/json:
 *                  schema:
 *                      $ref: '#/components/schemas/Result'
 */

无论我如何改变间距,都不会改变。我错过了什么吗?


 Error in src/api/controllers/user-table/join-table.js :
YAMLSyntaxError: All collection items must start at the same column at line 3, column 6:

     summary: Join table
     ^^^^^^^^^^^^^^^^^^^…
node.js xml express swagger swagger-ui
1个回答
0
投票

看起来你的

400
500
相差一格

@swagger:
/table/join:
  post:
    summary: Join table
    requestBody:
      description: Table and user uuids
      required: true
      content:
        application/json:
          schema:
            type: object
            properties:
              user_id:
                type: string
              table_uuid:
                type: string
    tags:
      - Table
    responses:
      "200":
        description: Your table created successfully.
        content:
          application/json:
            schema:
              type: object
              properties:
                resultMessage:
                  $ref: "#/components/schemas/ResultMessage"
                resultCode:
                  $ref: "#/components/schemas/ResultCode"
                uuid:
                  type: string
      "400":
        description: Please provide all the required fields!
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/Result"
      "500":
        description: An internal server error occurred, please try again.
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/Result"

© www.soinside.com 2019 - 2024. All rights reserved.