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 46 forks source link

Swagger node doesn't support multiple outputs nodes #44

Closed chaya7908 closed 4 years ago

chaya7908 commented 7 years ago

I have created flow with multiple outputs function node: node red The swagger output doesn't contains this path, since the response node is connected to the second output.

When I have connected it to the first output - it worked.

I think the following line is problematic: var wires = node.wires[0]; ( in function: checkWiresForHttpResponse swagger.js:129)

I changed it to be like that:

  function checkWiresForHttpResponse(node) {
      var outputs = node.wires;
      for (var o in outputs) {
          for (var w in outputs[o]) {
              var newNode = RED.nodes.getNode(outputs[o][w]);
              if (newNode.type == "http response") {
                  return true;
              } else if (checkWiresForHttpResponse(newNode)) {
                  return true;
              }
          }
      }
      return false;
  }

and it solved the problem.

knolleary commented 4 years ago

67 has been merged that should address this issue - version 0.1.9 of the node published to npm.