Skip to content

Commit

Permalink
Add support for route description meta
Browse files Browse the repository at this point in the history
  • Loading branch information
taylortom committed Oct 31, 2023
1 parent cb4dce8 commit 11e1201
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion swagger/swagger.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,11 @@ function generatePathSpec(app, router, paths = {}) {
const scopes = perms[method].find(p => route.match(p[0]))?.[1] || [];
let description = r.internal ? `ROUTE IS ONLY ACCESSIBLE FROM LOCALHOST.<br/><br/>` : '';
description += scopes.length ?
`Required scopes: ${scopes.map(s => `<span>${s}</apan>`).join(' ')}` :
`Required scopes: ${scopes.map(s => `<span>${s}</span>`).join(' ')}` :
'Route requires no authentication';

if(meta.description) description += `<br/><br/>${meta.description}`

return Object.assign(memo, {
[method]: {
...meta,
Expand Down

0 comments on commit 11e1201

Please sign in to comment.