2021-08-27 08:32:44 -04:00
|
|
|
import express from 'express'
|
2021-06-02 12:15:41 -04:00
|
|
|
|
2021-06-04 02:57:07 -04:00
|
|
|
function openapiOperationDoc (options: {
|
|
|
|
url?: string
|
|
|
|
operationId?: string
|
|
|
|
}) {
|
2021-06-02 12:15:41 -04:00
|
|
|
return (req: express.Request, res: express.Response, next: express.NextFunction) => {
|
2023-02-22 10:15:14 -05:00
|
|
|
res.locals.docUrl = options.url || 'https://docs.joinpeertube.org/api/rest-reference.html#operation/' + options.operationId
|
2021-06-02 12:15:41 -04:00
|
|
|
|
|
|
|
if (next) return next()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export {
|
2021-06-04 02:57:07 -04:00
|
|
|
openapiOperationDoc
|
2021-06-02 12:15:41 -04:00
|
|
|
}
|