From ae004f90384777a82cd464abc6b06fc6cf54b673 Mon Sep 17 00:00:00 2001 From: Carmine DiMascio Date: Mon, 21 Oct 2019 20:09:48 -0400 Subject: [PATCH] Creating multiple app instances causes spec read to be empty #81 (#82) * add type definitions * add types * fix spec loader * increment version --- package-lock.json | 2 +- package.json | 2 +- src/framework/util.ts | 7 +------ 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index e49dfa46..fdbabe90 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "express-openapi-validator", - "version": "2.8.0", + "version": "2.8.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 781e0bc1..a39d64b6 100644 --- a/package.json +++ b/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": { diff --git a/src/framework/util.ts b/src/framework/util.ts index 403de5ca..34dbcfa1 100644 --- a/src/framework/util.ts +++ b/src/framework/util.ts @@ -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;