Reputation: 1893
I'm trying to import a Json file from Swagger to insomnia. To do that I use this project from NPM (I'm not familiar with NPM):
https://www.npmjs.com/package/insomnia-importers
I have npm v6.5.0 and node v11.9.0 installed.
I ran this command: `insomnia-import /path/to/swagger-export.json
insomnia-export.json:
(node:38053) UnhandledPromiseRejectionWarning: TypeError: Cannot
convert undefined or null to object
at Function.keys (<anonymous>)
at object (/Users/user/.nvm/versions/node/v11.9.0/lib/node_modules/insomnia-importers/src/importers/swagger2.js:300:14)
at generateParameterExample (/Users/user/.nvm/versions/node/v11.9.0/lib/node_modules/insomnia-importers/src/importers/swagger2.js:332:12)
at Object.keys.forEach.propertyName (/Users/user/.nvm/versions/node/v11.9.0/lib/node_modules/insomnia-importers/src/importers/swagger2.js:301:33)
at Array.forEach (<anonymous>)
at object (/Users/user/.nvm/versions/node/v11.9.0/lib/node_modules/insomnia-importers/src/importers/swagger2.js:300:31)
at generateParameterExample (/Users/user/.nvm/versions/node/v11.9.0/lib/node_modules/insomnia-importers/src/importers/swagger2.js:332:12)
at prepareBody (/Users/user/.nvm/versions/node/v11.9.0/lib/node_modules/insomnia-importers/src/importers/swagger2.js:242:37)
at importRequest (/Users/user/.nvm/versions/node/v11.9.0/lib/node_modules/insomnia-importers/src/importers/swagger2.js:173:11)
at tags.forEach (/Users/user/.nvm/versions/node/v11.9.0/lib/node_modules/insomnia-importers/src/importers/swagger2.js:129:21)
(node:38053) UnhandledPromiseRejectionWarning: Unhandled promise
rejection. This error originated either by throwing inside of an async
function without a catch block, or by rejecting a promise which was
not handled with .catch(). (rejection id: 1) (node:38053) [DEP0018]
DeprecationWarning: Unhandled promise rejections are deprecated. In
the future, promise rejections that are not handled will terminate the
Node.js process with a non-zero exit code.
What is the problem here?
Upvotes: 5
Views: 14590
Reputation: 326
Insomnia maintainer here.
Insomnia uses the insomnia-import package internally so you don't have to. You can import your Swagger file directly into Insomnia and it will import it.
Upvotes: 10