-
Notifications
You must be signed in to change notification settings - Fork 56
Description
Hello !
i tried to use node-red-nodegen with OpenAPI defintions but got error messages,
I would be very plased is some could give reason of these errors and offer some workarouds
My environment :
Node generator version: 0.1.1
Node-RED version: v1.3.5
Node.js version: v14.17.0
npm version: 6.14.13
Platform/OS: Ubuntu 20.04
Browser: FireFox Version 89.0 (64-bit)
I want use node-red-nodegen with OpenAPI description :
https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.0/petstore.yaml
I used also https://editor.swagger.io/ to conert yaml to json format,
Then i tried to use node-red-nodegen with this OpenAPI defintions i got flollowing errors
node-red-nodegen openapi.json --name 'xroad-management-ui'
Error: TypeError: Cannot read property 'definitions' of undefined
TypeError: Cannot read property 'definitions' of undefined
at /usr/local/lib/node_modules/node-red-nodegen/node_modules/swagger-js-codegen-formdata/lib/typescript.js:48:43
at arrayEach (/usr/local/lib/node_modules/node-red-nodegen/node_modules/lodash/lodash.js:530:11)
at Function.forEach (/usr/local/lib/node_modules/node-red-nodegen/node_modules/lodash/lodash.js:9410:14)
at convertType (/usr/local/lib/node_modules/node-red-nodegen/node_modules/swagger-js-codegen-formdata/lib/typescript.js:44:19)
at /usr/local/lib/node_modules/node-red-nodegen/node_modules/swagger-js-codegen-formdata/lib/typescript.js:62:32
at /usr/local/lib/node_modules/node-red-nodegen/node_modules/lodash/lodash.js:4967:15
at baseForOwn (/usr/local/lib/node_modules/node-red-nodegen/node_modules/lodash/lodash.js:3032:24)
at /usr/local/lib/node_modules/node-red-nodegen/node_modules/lodash/lodash.js:4936:18
at Function.forEach (/usr/local/lib/node_modules/node-red-nodegen/node_modules/lodash/lodash.js:9410:14)
at Object.convertType (/usr/local/lib/node_modules/node-red-nodegen/node_modules/swagger-js-codegen-formdata/lib/typescript.js:61:15)
at /usr/local/lib/node_modules/node-red-nodegen/node_modules/swagger-js-codegen-formdata/lib/codegen.js:184:24
at /usr/local/lib/node_modules/node-red-nodegen/node_modules/lodash/lodash.js:4967:15
at baseForOwn (/usr/local/lib/node_modules/node-red-nodegen/node_modules/lodash/lodash.js:3032:24)
at /usr/local/lib/node_modules/node-red-nodegen/node_modules/lodash/lodash.js:4936:18
at Function.forEach (/usr/local/lib/node_modules/node-red-nodegen/node_modules/lodash/lodash.js:9410:14)
at getViewForSwagger2 (/usr/local/lib/node_modules/node-red-nodegen/node_modules/swagger-js-codegen-formdata/lib/codegen.js:180:7)
Then i tried the yaml format file
then then at firist the following output was displayed:
Error: Error: ENAMETOOLONG: name too long, open '---
after that the content on yaml and at end the following lines was displyed:
'
at Object.openSync (fs.js:498:3)
at Object.readFileSync (fs.js:394:35)
at Function.Utils.getStringFromFile (/usr/local/lib/node_modules/node-red-nodegen/node_modules/yamljs/lib/Utils.js:284:19)
at Function.Yaml.parseFile (/usr/local/lib/node_modules/node-red-nodegen/node_modules/yamljs/lib/Yaml.js:46:21)
at Function.Yaml.load (/usr/local/lib/node_modules/node-red-nodegen/node_modules/yamljs/lib/Yaml.js:78:17)
at getSpec (/usr/local/lib/node_modules/node-red-nodegen/lib/swagger/index.js:27:27)
at Object.module.exports [as SwaggerNodeGenerator] (/usr/local/lib/node_modules/node-red-nodegen/lib/swagger/index.js:51:16)