node-red / node-red-node-swagger

A set of tools for generating Swagger api documentation based on the HTTP nodes deployed in a flow
Apache License 2.0
62 stars 47 forks source link

Cannot use status on node object when using RED.nodes.eachNode(function(node)) #31

Closed codymwalker closed 8 years ago

codymwalker commented 8 years ago
RED.nodes.eachNode(function(node) {
    ...
    node.status({});
    ...
});

results in

TypeError: Object #<Object> has no method 'status' at C:\Users\cody\Downloads\node-red-0.12.0\node-red-0.12.0\node_modules\node-red-node-swagger\swagger\swagger.js:126:26

knolleary commented 8 years ago

Spotted this one this afternoon.

Need to have a discussion about this functionality. I don't think we want to expose the node runtime objects to allow their functions to be called like this. I over looked that the swagger node did this when I made some of the changesin .12.

codymwalker commented 8 years ago

Gotcha.

Had actually just sent you an email about his as well. I just wanted to follow up and make sure that it was intentional. If you don't want those functions exposed, I can remove the status calls from this node, as they'll always be external to the actual node.

knolleary commented 8 years ago

Yeah - allowing a node direct access to another node's functions is just asking for trouble and will tie our hands in the future.

I think we should remove these calls - I'm happy to sort that out tomorrow unless you get a PR in before then.

codymwalker commented 8 years ago

PR is #32. Removed the nls for the status messages as well.