It does not throw any error. It created swagger json. But json does not contain schema information. Backend API uses POST method and takes 3 fields in the json format. Both request & response are in json format.
? Unique string used to identify the operation. ? uniqueId
? A list of tags for API documentation control. ? api2swagger
Making an API Call & fetching more details…Please stay tuned.. Api2swagger needs details related to Header : Authorization
? Name of Header Param ? Authorization
? Description of URL Param ? token field
? Type of query param ? string
Please provide more details regarding request payload..
readline.js:1016 throw err;
TypeError: Cannot read property ‘indexOf’ of undefined at getBodyInfo (C:\Users\xyz\AppData\Roaming\npm\node_modules\api2swagger\lib\execute\api.js:409:42) at bodyInfo (C:\Users\xyz\AppData\Roaming\npm\node_modules\api2swagger\lib\execute\api.js:145:11) at C:\Users\xyz\AppData\Roaming\npm\node_modules\api2swagger\node_modules\async\lib\async.js:718:13 at iterate (C:\Users\xyz\AppData\Roaming\npm\node_modules\api2swagger\node_modules\async\lib\async.js:262:13) at C:\Users\xyz\AppData\Roaming\npm\node_modules\api2swagger\node_modules\async\lib\async.js:274:29 at C:\Users\xyz\AppData\Roaming\npm\node_modules\api2swagger\node_modules\async\lib\async.js:44:16 at C:\Users\xyz\AppData\Roaming\npm\node_modules\api2swagger\node_modules\async\lib\async.js:723:17 at C:\Users\xyz\AppData\Roaming\npm\node_modules\api2swagger\node_modules\async\lib\async.js:167:37 at done (C:\Users\xyz\AppData\Roaming\npm\node_modules\api2swagger\lib\execute\api.js:379:7) at C:\Users\xyz\AppData\Roaming\npm\node_modules\api2swagger\node_modules\async\lib\async.js:52:16
I got it fixed. removed single quotations and appended with \ for quotations and removed the spaces. Though below url says that data should be surrounded by single quotes, api2swagger is reading the single quote as is and throwing JSON parse error. Also, we need to use \ for escaping double quotes.
If there are spaces, then api2swagger is not able to read the complete payload. need to sure there are no spaces in the json string.