Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orphan tag error with empty @returns jsdocs on 6.6.0 #1741

Open
2 of 4 tasks
sinomsinom opened this issue Jan 10, 2025 · 0 comments
Open
2 of 4 tasks

Orphan tag error with empty @returns jsdocs on 6.6.0 #1741

sinomsinom opened this issue Jan 10, 2025 · 0 comments

Comments

@sinomsinom
Copy link

Sorting

  • I'm submitting a ...

    • bug report
    • feature request
    • support request
  • I confirm that I

    • used the search to make sure that a similar issue hasn't already been submit

Expected Behavior

/**
* @returns
*/
@Get()
public async testEndpoint(
    @Body()
    test: {test:string}
): Promise<number>
{
    return 1.5
}

and

/**
* @returns {Promise<number>}
*/
@Get()
public async testEndpoint(
    @Body()
    test: {test:string}
): Promise<number>
{
    return 1.5
}

should be usable without errors on generate

Current Behavior

Tsoa throws the following error when trying to spec-and-routes:

 in 'Controller.test'
    at <path-to-project>\node_modules\@tsoa\cli\dist\metadataGeneration\methodGenerator.js:114:23
    at Array.map (<anonymous>)
    at MethodGenerator.buildParameters (<path-to-project>\node_modules\@tsoa\cli\dist\metadataGeneration\methodGenerator.js:106:14)
    at MethodGenerator.Generate (<path-to-project>\node_modules\@tsoa\cli\dist\metadataGeneration\methodGenerator.js:76:33)
    at <path-to-project>\node_modules\@tsoa\cli\dist\metadataGeneration\controllerGenerator.js:46:41
    at Array.map (<anonymous>)
    at ControllerGenerator.buildMethods (<path-to-project>\node_modules\@tsoa\cli\dist\metadataGeneration\controllerGenerator.js:46:14)
    at ControllerGenerator.Generate (<path-to-project>\node_modules\@tsoa\cli\dist\metadataGeneration\controllerGenerator.js:35:27)
    at <path-to-project>\node_modules\@tsoa\cli\dist\metadataGeneration\metadataGenerator.js:210:41
    at Array.map (<anonymous>)

Steps to Reproduce

Add a @returns jsdocs comment to any endpoint without adding a comment after it, either leaving it blank or only adding a type in curly braces

Context (Environment)

Version of the library: v6.6.0
Version of NodeJS: v22.12.0

  • Confirm you were using yarn not npm: [X]

Detailed Description

After upgrading from 6.5.1 to 6.6.0 empty or type only @returns tags started throwing errors when generating.
This error doesn't happen if there are no parameter tags (like the @Body tag in the example).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant