SwagGen icon indicating copy to clipboard operation
SwagGen copied to clipboard

"description" aka doc comments don't get generated nicely

Open rogerluan opened this issue 4 years ago • 0 comments

Hey 👋

I've found an issue where code like this:

/**
* This is a multiline
* comment.
*/
public myProperty: MyClass[];

Gets translated into this swagger json:

…
"myProperty": {
    "description": "* This is a multiline\n\t *  comment.",
    "items": {
        "$ref": "#/components/schemas/MyClass"
    },
    "type": "array"
},
…

Which SwagGen (understandably) generates this:

// * This is a multiline
 * comment.
public var myProperty: [MyClass]

Although swagger could do a bit better with providing a better generated "description" (e.g. not including the * characters), I think SwagGen should at least provide code that compiles, e.g.:

/// * This is a multiline
/// * comment.
public var myProperty: [MyClass]

In other words: using the dedicated doc comment syntax (///) and adding that delimited to the start of the line so that it's recognized as a doc comment (which makes the code compile).

Has this been considered? Or is there a better way to annotate doc comments in javascript? All the help is highly appreciated 🙏 Thanks!

rogerluan avatar Jan 09 '22 21:01 rogerluan