Skip to content

i tried to use node-red-nodegen is failing with OpenAPI defintions with error messages #124

Description

@lauri-aloauri

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions