ad-on-is / adonis-autoswagger

Auto-Generate swagger docs for AdonisJS
MIT License
116 stars 38 forks source link

Bug: Same Prefixed Method's Docs Conflict #63

Closed HasanAshab closed 6 months ago

HasanAshab commented 6 months ago

My controller has 2 methods logout and logoutOnDevice with same prefix logout. Thats why AutoSwagger respects the last comment block and use that for both

  /**
   * @logout
   * @summary Logout a user
   * @responseBody 200 - { message: "Logged out successfully" }
   */
  async logout({ auth }: HttpContext) {
    await this.authService.logout(auth.user!)
    return 'Logged out successfully!'
  }

  /**
   * @logoutOnDevice
   * @summary Logout a user on specific device
   * @responseBody 200 - { message: "Logged out successfully" }
   */
  async logoutOnDevice({ request, params, auth }: HttpContext) {
    await this.authService.logoutOnDevice(auth.user!, params.id)
    return 'Logged out successfully!'
  }

AutoSwagger searchs for action name on comments by includes()

comment.value.includes("@" + action) // src/parsers.ts:471

This part causing the bug

ad-on-is commented 6 months ago

Would you mind sharing the corresponding routes?

ad-on-is commented 6 months ago

This should be fixed in 3.2.0