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

Path parameters not supported #2

Closed knolleary closed 9 years ago

knolleary commented 9 years ago

An HTTP In node can identify named path parameters using the Express syntax:

/pet/:petId

The swagger doc node should spot those parameters and automatically add parameter entries for them.

In the generated swagger, the format needs to be transformed to:

/pet/{petId}
codymwalker commented 9 years ago

Ahh, I was unaware that the HTTP In node supported path parameters, so I had taken path support out of the swagger node until we could discuss it. Will revisit with the new knowledge.

codymwalker commented 9 years ago

Checked in a change set to address this. The node will convert :petId to {petId}. The editor will also pick up that there are path params in the URL, and include them in the swagger doc config dialog. The user can edit the description and type, but cannot edit the name or in fields for these params, and they cannot be removed. Instead, the editor checks the url and adds new path parameters to the doc when needed, and also cleans up old path params that no longer exist.

knolleary commented 9 years ago

@lostinthestory can you raise a pull request for this? and for the fix you did for #4

BTW, for future reference, preferred commit message style is:

First line:  A short summary of the change
Second line: If it fixes an issue, something like "Fixes #2" or "Closes #2" - Github will automatically close issues when it sees a commit merged with such a statement.
Third line onwards: a longer description if it is needed

Point being, don't reference an issue # in the first line of the commit.

knolleary commented 9 years ago

Ah - just saw the PR arrive. Thanks :)

codymwalker commented 9 years ago

I got the email just as I was submitting the PR. Will keep that in mind with the commit messages. Wasn't sure about auto closing the issues until the changes were merged into master.

knolleary commented 9 years ago

The auto-close only occurs when the commit is merged into this repo - ie, when the PR is merged.

codymwalker commented 9 years ago

Ah, excellent! Good to know! Thanks