Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 45x 208x 208x 208x | import { OpenAPIV3 } from 'express-openapi-validator/dist/framework/types';
export const versionPathFromSpec = (specPath: string) => {
try {
const apiDoc = require(specPath) as OpenAPIV3.Document;
return `/v${apiDoc.info.version}`;
} catch (error) {
throw new Error(
`Reading version from '${specPath}' due to\n${error instanceof Error ? error.stack : JSON.stringify(error)}\n`
);
}
};
|