0

Need help swagger-jsdoc documentation. This is the first time I am working with. I get the following error for the below @swagger jsdoc documentation.

/**
 * @swagger
 *  /v1/expected_rate/get_objects:
 *  get: 
 *      description: Get objects for the user logged in company.
 *  tags: 
 *  - ObjectGenerator
 *  produces: application/json
 *  responses:
 *  '200':
 *      description:A successful response. Returns a Array of Objects.
 *      examples:
 *          application/json: 
 *          - {
 *              "prop_1": 1,
 *              "prop_2": "123456789",
 *              "prop_3": 438,
 *              "prop_4": 1 
 *          }
 */

Error: YAMLException: bad indentation of a mapping entry at line 10, column 14: examples: ^ at module.exports (C:\Documents\node_modules\swagger-jsdoc\lib\index.js:37:11) at Object. (C:\GIT Repository\app.js:91:19) at Module._compile (internal/modules/cjs/loader.js:651:14) at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10) at Module.load (internal/modules/cjs/loader.js:566:32) at tryModuleLoad (internal/modules/cjs/loader.js:506:12) at Function.Module._load (internal/modules/cjs/loader.js:498:3) at Function.Module.runMain (internal/modules/cjs/loader.js:695:10) at startup (internal/bootstrap/node.js:201:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:516:3)

1 Answers1

0

The indentation does not look right. Try the following:

/**
 * @swagger
 * /v1/expected_rate/get_objects:
 *   get: 
 *     description: Get objects for the user logged in company.
 *     tags: 
 *       - ObjectGenerator
 *     produces:
 *       - application/json
 *     responses:
 *       '200':
 *         description: A successful response. Returns a Array of Objects.
 *         examples:
 *           application/json: 
 *             - {
 *                 "prop_1": 1,
 *                 "prop_2": "123456789",
 *                 "prop_3": 438,
 *                 "prop_4": 1 
 *               }
 */
Helen
  • 87,344
  • 17
  • 243
  • 314