knuckleswtf / scribe-js

Generate API documentation for humans from your Node.js codebase.

Home Page:https://scribe.knuckles.wtf/nodejs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Description for @urlParam is ignored

jipis opened this issue Β· comments

I have the following

/**
* Here be my title
*
* And this is a description
*
* @urlParam {string} theParam required This should be the description. Example: its-a-string
* @urlParam {int} anotherParam This is another description
*/
server.get('/:theParam/:anotherParam', (req, res, next) => {
...

It seems that the @urlParam parser is ... exiting early? I can't provide a screenshot for unimportant reasons. But, what I get as output in the html page here is the "URL Parameters" header followed by
theParam string
anotherParam string

It is completely ignoring everything other than the @urlParam and the variable name tokens on those lines. The example text isn't used in the example request. The description is completely missing. required vs not having it there makes no difference. And the type is even ignored (as the int is showing in the doc as string).

Okay, but you need to provide environment information. Framework, versions, etc.

Also, have you tried updating to the latest version first?

Oops, sorry.

I was looking for a template to follow to indicate all info you want/need for bug reports, but I didn't see one. Gave as much as I thought of offhand.

I'm using restify 8.5.1 with scribe-restify 1.2.0 on node 15.6.0.

Yeah, that was an oversight. πŸ˜… Added a template now.

Try upgrading to the latest version of the package first (1.6.0). Note that in the latest version, you don't need to add the require(...) statement to your code anymore.

ok, I'm up to 1.8.1 now.

/**
 * Decode a tinyUrl
 *
 * Take a tiny URL (previously generated), look it up in the database,
 * and redicrect the browser to it.
 *
 * @urlParam {string} tinyUrlId required The id of the tinyUrl to redirect to. Example: 14e2b706-d4fc-11eb-9b30-0e285caff4d5
 * @urlParam {int} foo This is made up for example purposes. Example: 41380
 */
server.get('/:tinyUrlId/:foo', (req, res, next) => {

Generates
image

Note how really everything other than the name of the param (to include the required/not-required, description, type, and example) is ignored.

On it.

Can you try now? Should be fixed now (v1.8.2).

Erm, actually, worse. Exact same code as listed above. Upgraded to 1.8.2. And got this:
image

Note that "Endpoints" has become "undefined". And the entire docblock is apparently being ignored now.

Ah, fuck. I think I know what's the problem.

Okay, fixed for real this time.πŸ˜… 1.8.3

Ooh, almost! The documentation itself seems to be right now. Just the example is off now. Same code as above now generates this.
image

Tried to take a look myself, but it looks like the code to generate 1.8.3 didn't get pushed to github.

Fixed now πŸ‘

BTW, the TS code is in the src/ folder. Generated is in dist/. I'll add a contributing guide for v2, but in the meantime, you can actually just edit the generated files if you can't find any other way.

We have a winner!!

Thanks so much for your help! Good to go!

For reference, same code as before is now awesomely correctly generating

image

Awesome.πŸ‘

Watch out for v2, coming with more customizability and smarter inference.