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

x759pob2  于 11个月前  发布在  Node.js
关注(0)|答案(1)|浏览(197)

我在使用swagger.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
     ^^^^^^^^^^^^^^^^^^^…

pokxtpni

pokxtpni1#

看起来你的400500相差一个空格

@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"

字符串

相关问题