Open shrickus opened 6 years ago
Another broken condition related to this issue -- the node-link traversal seems to only follow wires from the 1st output port of a switch
node (and probably other nodes with multiple output ports?).
While developing most of my http "endpoint" flows, I use inject nodes as an alternate way to test the logic of the flow. So at the end of the flow is a switch node that checks if msg.req is not null, and sends the response to an http response
node (or a debug
node, if not initiated from an http in
node). If I test for null first (connected to the debug node) then my endpoint does not show up in the swagger sidebar -- even though there is an http response node at the end of the flow.
I tracked down why my new http endpoint was not showing in the Swagger sidebar... the code searches from the
http in
node until it finds a connectedhttp response
node -- and if it doesn't find one, it won't show in the Operation List.This check is good -- however, in my case, the
http response
node IS connected, but through a link out/in pair, which is causing my api to be excluded from the Operations list. The function that does this validation is:I tried to "hop over" the link nodes, by checking if
node.type === "link out"
, then use thenode.links
array (instead ofwires[0]
). Althoughnode.links
exists in the flows.json file, once it is loaded into the runtime, that attribute is no longer available... (?) hmmmSo it probably requires an intermediate node lookup, something like this (untested)?
However, this assumes there is only one
link in
connected to eachlink out
-- so some iteration will probably be needed. And will this work for wires connected to subflows? Probably not, which makes me wonder if this validation is even necessary.Today, any
http in
node wired to anhttp response
node will appear in the list of Swagger Operations. Instead, I suggest we eliminate the checkWires validation, and only include thosehttp in
nodes that have aswagger-doc
node defined. I'd be happy to submit a PR with these and any other necessary changes, if you agree with my assessment.