Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function transform(routes: RouteInfo[]) {
const group = groupRoutes(routes)
const paths = transformPaths(group)
return OpenApiBuilder.create({
openapi: "3.0.0",
info: { title: "title", version: "1.0.0" },
paths
}).getSpec()
}
private generateApiOpenApiSpecBuilder(appConfig: AppConfig, middlewareRegistry: MiddlewareRegistry) {
let openApiBuilder = OpenApiBuilder.create()
let paths: IDictionary = {}
let tags: IDictionary = {}
this.logger.debug("Generating OpenAPI spec")
if (appConfig.name) {
this.logger.trace("title: %s", appConfig.name)
openApiBuilder.addTitle(appConfig.name)
}
if (appConfig.version) {
this.logger.trace("version: %s", appConfig.version)
openApiBuilder.addVersion(appConfig.version)
}