watson-developer-cloud / node-red-node-watson

A collection of nodes for the IBM Watson services
Apache License 2.0
82 stars 86 forks source link

Document conversion destroys incoming msg context #217

Closed rcruicks closed 7 years ago

rcruicks commented 7 years ago

most other nodes (have not checked all) take the approach of placing the Watson output in the payload of the incoming msg object - i.e. msg.payload = watson-response; node.send(msg);

Document conversion overwrites current msg by using - node.send({"payload": watson-response});

this obliterates the original URL in the payload, and any other msg properties (_id, url, topic, etc); makes it unnecessarily complicated to convert a document, and immediately store in cloudant or other repository, having set doc id and url to tag the doc in the database

chughts commented 7 years ago

Then team are investigating will reply here.

gibfahn commented 7 years ago

@rcruicks So to clarify, the issue is that the document conversion node clears all the msg.xxx properties and returns a msg object containing only the msg.payload?

If we were to pass on the original msg object and simply change the msg.payload then that would work for you?

rcruicks commented 7 years ago

@gibfahn hi Gibson - yes - from what I can see, all other Watson nodes take this approach, returning the Watson response in the payload of the original msg, or in a new msg property (msg.transcript, msg,speech, and the like) general node-red node behaviour is to pass on the original msg; this is often needed for things like http-in request flows, which need msg.req to be able to respond through http-response

chughts commented 7 years ago

Fixed in 0.4.29