node-red-node-swagger icon indicating copy to clipboard operation
node-red-node-swagger copied to clipboard

Swagger UI not displayed

Open oprince opened this issue 8 years ago • 7 comments

When loading Node-red UI in chrome, following exception is printed in browser console:

Uncaught TypeError: Cannot read property 'type' of undefined at Object. (swagger-ui.js:254) at Object.10 (swagger-ui.js:778) at Object.f [as inverse] (handlebars-2.0.0.js:27) at Object. (handlebars-2.0.0.js:27) at Object.9 (swagger-ui.js:773) at Object.f [as inverse] (handlebars-2.0.0.js:27) at Object. (handlebars-2.0.0.js:27) at Object.main (swagger-ui.js:789) at e (handlebars-2.0.0.js:27) at s.render (swagger-ui.js:26072)

oprince avatar Jan 11 '17 16:01 oprince

Hi - what versions of node.js / node-red / node-red-node-swagger ui are you using?

You've been using the swagger node for some time. Is this the first time you've tried it on Chrome?

knolleary avatar Jan 11 '17 16:01 knolleary

Hi,

The versions I use are Node.js: 4.4.7 node-red: 0.14.6 node-red-node-swagger: 0.1.8

I have another project running on the same environment (with Chrome), for which Swagger-UI is displayed correctly.

Seems to be a problem in flows file. I have found an error in method swagger.checkWiresForHttpResponse . There was a case were the wired node was null, causing exception at line

if(newNode.type == "http response")

So, I tried deleting the flow which is leading to that error, but it did not help much. Can I send you the flows file by mail ?

oprince avatar Jan 12 '17 06:01 oprince

The problem was solved in swagger-ui module file: swagger-ui.js method: Handlebars.registerHelper replace the following line: var paramType = param.type || param.schema && param.schema.type || ''; with the fixed line: var paramType = (param.schema) ? param.type || param.schema.type || '' : param.type || '';

oprince avatar Jan 12 '17 09:01 oprince

Please do share the flow file.

Is it one you've manually generated somehow? Does it involve subflows?

... ok, I see you've just closed this having manually fixed something... Does that mean there's nothing for us to do? Does this fix need applying somewhere?

knolleary avatar Jan 12 '17 09:01 knolleary

I have created pull request in swagger-ui repository: https://github.com/swagger-api/swagger-ui/pull/2607

The flow was edited only with node-red editor. Yes, it contains subflows. Sending by mail.

oprince avatar Jan 12 '17 09:01 oprince

Ok, so we better leave this open so we pick up the fixed swagger-ui when it gets resolved.

knolleary avatar Jan 12 '17 09:01 knolleary

Alas this one won't get resolved this way because the swagger-ui PR submitted by @oprince was rejected due to the changes being made to the dist folder not the source.

JonSilver avatar Sep 13 '19 13:09 JonSilver