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

Swagger node status not showing nls value #25

Closed codymwalker closed 9 years ago

codymwalker commented 9 years ago

Instead of pulling the value from the locale document, the swagger status is showing "swagger.status.missingconfig".

image

I believe the swagger locale namespace is not being picked up before the editor is being loaded. This timing issue is causing the swagger statuses to be unknown to the editor.

knolleary commented 9 years ago

I missed this in the original PR (I know I commented on the nls of the status message, I just didn't catch on to why you were doing it) - it appears you're sending a status message to the http node from the swagger node? The status message is being given to the http node to translate, so it uses the http node's namespace.

You will need to provide the fully qualified message identifier including its namespace:

node-red-node-swagger:swagger.status.missingconfig

should do it.

codymwalker commented 9 years ago

Ah, excellent. Will test this out this afternoon. On Aug 13, 2015 11:22 AM, "knolleary" notifications@github.com wrote:

I missed this in the original PR (I know I commented on the nls of the status message, I just didn't catch on to why you were doing it) - it appears you're sending a status message to the http node from the swagger node? The status message is being given to the http node to translate, so it uses the http node's namespace.

You will need to provide the fully qualified message identifier including its namespace:

node-red-node-swagger:swagger.status.missingconfig

should do it.

— Reply to this email directly or view it on GitHub https://github.com/node-red/node-red-node-swagger/issues/25#issuecomment-130749533 .

codymwalker commented 9 years ago

Hmm, even when passing the identifier including namespace, it does not load the message from the locale.

image

I tested this elsewhere, in the Google nodes, and even when passing in its own namespace, it does not find the message.

plus.status.failed should equal node-red-node-google:plus.status.failed

image image

knolleary commented 9 years ago

Ah - double checked the code, and support for cross-namespace nls of status messages didn't get implemented as we had no need for it.

This will require a change in node-red (and a new release for you guys to pick up). What's the intent of the swagger node provided status messages to the http node?

knolleary commented 9 years ago

Actually, I take that back... it is there.

I got the namespace wrong. Try:

node-red-node-swagger/swagger:swagger.status.missingconfig
codymwalker commented 9 years ago

Perfect! That does work

knolleary commented 9 years ago

Phew :+1:

codymwalker commented 9 years ago

Here's the use cases btw:

image

If a user has the swagger plugin installed, they get additional statuses on their http-in nodes to help determine if they're included in swagger generation.

If an http-in node does not have an http-out node attached, we alert them that it is excluded from swagger gen.

If an http-in node does have an http-out node attached, but does not have a user defined swagger doc config set, we alert them, so they know they are getting they 'default swagger' in swagger gen.

We go across namespace and set it from the swagger plugin so these messages are only appearing to the relevant user base -- those with the swagger plugin installed.