Currently working on some documentation for a javascript project and I would like to document the following:
/**
* Express router to mount admin related functions on.
* @namespace AdminRoutes
*/
const router = express.Router()
/**
* Finds an admin based on the admin id stored in the session.
* @function
* @name get/:adminId
* @memberof AdminRoutes
* @param {string} adminId - The id of the admin to get.
* @returns {Object} Returns an Admin object.
*/
router.get('/:adminId', async (request, response, next) => {
try {
return response.json(await Admin.findOne(request.session.user.id))
} catch (error) {
return next(error)
}
})
This would work completely fine if this were a normal function, but when documenting as a route, the generate documentation shows up as a normal function named 'get' with adminId as a param. It is almost as if JSDoc is not respecting the @name field when naming the function. Is there a way around this or a proper way of documenting routes with params? Any suggestions would be greatly appreciated. Thanks!