Skip to content

Commit ae004f9

Browse files
authored
Creating multiple app instances causes spec read to be empty #81 (#82)
* add type definitions * add types * fix spec loader * increment version
1 parent 9e660a3 commit ae004f9

File tree

3 files changed

+3
-8
lines changed

3 files changed

+3
-8
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "express-openapi-validator",
3-
"version": "2.8.0",
3+
"version": "2.8.1",
44
"description": "Automatically validate API requests using an OpenAPI 3 and Express.",
55
"main": "dist/index.js",
66
"scripts": {

src/framework/util.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,7 @@ export function loadSpecFile(filePath) {
2828
if (typeof filePath === 'string') {
2929
const absolutePath = path.resolve(process.cwd(), filePath);
3030
if (fs.existsSync(absolutePath)) {
31-
try {
32-
// json or module
33-
return require(absolutePath);
34-
} catch (e) {
35-
return fs.readFileSync(absolutePath, 'utf8');
36-
}
31+
return fs.readFileSync(absolutePath, 'utf8');
3732
}
3833
}
3934
return null;

0 commit comments

Comments
 (0)