Skip to content

Commit

Permalink
Creating multiple app instances causes spec read to be empty #81 (#82)
Browse files Browse the repository at this point in the history
* add type definitions

* add types

* fix spec loader

* increment version
  • Loading branch information
cdimascio committed Oct 22, 2019
1 parent 9e660a3 commit ae004f9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "express-openapi-validator",
"version": "2.8.0",
"version": "2.8.1",
"description": "Automatically validate API requests using an OpenAPI 3 and Express.",
"main": "dist/index.js",
"scripts": {
Expand Down
7 changes: 1 addition & 6 deletions src/framework/util.ts
Expand Up @@ -28,12 +28,7 @@ export function loadSpecFile(filePath) {
if (typeof filePath === 'string') {
const absolutePath = path.resolve(process.cwd(), filePath);
if (fs.existsSync(absolutePath)) {
try {
// json or module
return require(absolutePath);
} catch (e) {
return fs.readFileSync(absolutePath, 'utf8');
}
return fs.readFileSync(absolutePath, 'utf8');
}
}
return null;
Expand Down

0 comments on commit ae004f9

Please sign in to comment.