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