apib2swagger icon indicating copy to clipboard operation
apib2swagger copied to clipboard

Crash with .length of undefined

Open JesperWe opened this issue 6 years ago • 3 comments

TypeError: Cannot read property 'length' of undefined
    at convertMsonToJsonSchema (/usr/local/lib/node_modules/apib2swagger/src/mson_to_json_schema.js:30:38)
    at /usr/local/lib/node_modules/apib2swagger/index.js:47:67
    at Array.forEach (<anonymous>)
    at /usr/local/lib/node_modules/apib2swagger/index.js:38:26
    at Array.forEach (<anonymous>)
    at module.exports.convertParsed (/usr/local/lib/node_modules/apib2swagger/index.js:33:8)
    at Object.exports.convert (/usr/local/lib/node_modules/apib2swagger/index.js:374:23)
    at processBlueprint (/usr/local/lib/node_modules/apib2swagger/bin/apib2swagger.js:87:18)
    at ReadStream.on.on (/usr/local/lib/node_modules/apib2swagger/bin/apib2swagger.js:67:5)
    at emitNone (events.js:111:20)

Gist for the file: https://gist.github.com/JesperWe/8ce928186f25a8739e31af43f76dc375

JesperWe avatar Sep 11 '18 11:09 JesperWe

I fixed a bug at v1.3.1. Thank you!

kminami avatar Sep 11 '18 21:09 kminami

Hi @kminami, it seems like the issue still persists. Sample file is from Teamleader Focus

When running the command apib2swagger -i C:\Users\Dev\Downloads\teamleadercrm.apib, the program crashes with the log

TypeError: Cannot read properties of undefined (reading 'length')
    at convertEnum (C:\Users\Dev\AppData\Roaming\npm\node_modules\apib2swagger\src\mson_to_json_schema.js:103:34)
    at convert (C:\Users\Dev\AppData\Roaming\npm\node_modules\apib2swagger\src\mson_to_json_schema.js:35:20)
    at C:\Users\Dev\AppData\Roaming\npm\node_modules\apib2swagger\src\mson_to_json_schema.js:32:83
    at Array.map (<anonymous>)
    at convert (C:\Users\Dev\AppData\Roaming\npm\node_modules\apib2swagger\src\mson_to_json_schema.js:32:72)
    at convert (C:\Users\Dev\AppData\Roaming\npm\node_modules\apib2swagger\src\mson_to_json_schema.js:59:30)
    at convertMsonToJsonSchema (C:\Users\Dev\AppData\Roaming\npm\node_modules\apib2swagger\src\mson_to_json_schema.js:6:18)
    at C:\Users\Dev\AppData\Roaming\npm\node_modules\apib2swagger\index.js:77:32
    at Array.forEach (<anonymous>)
    at C:\Users\Dev\AppData\Roaming\npm\node_modules\apib2swagger\index.js:62:26

maxi07 avatar Jan 10 '23 20:01 maxi07

Hi @maxi07, I have fixed the issue around teamleadercrm.apib at v1.16.1. Please confirm. Thank you!

kminami avatar Jan 29 '23 14:01 kminami