From 719dfbfa1348c1659c460db21f92a07620ad38a6 Mon Sep 17 00:00:00 2001 From: LeFnord Date: Tue, 6 Sep 2016 10:52:31 +0200 Subject: [PATCH] makes basePath optional --- lib/utils/SpecManager.ts | 3 ++- tests/schemas/api-info-test.json | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/utils/SpecManager.ts b/lib/utils/SpecManager.ts index 886d5f54..32149e9c 100644 --- a/lib/utils/SpecManager.ts +++ b/lib/utils/SpecManager.ts @@ -56,7 +56,8 @@ export class SpecManager { } let host = this._schema.host || urlParts.host; - this.apiUrl = protocol + '://' + host + this._schema.basePath; + let basePath = this._schema.basePath || '/'; + this.apiUrl = protocol + '://' + host + basePath; if (this.apiUrl.endsWith('/')) { this.apiUrl = this.apiUrl.substr(0, this.apiUrl.length - 1); } diff --git a/tests/schemas/api-info-test.json b/tests/schemas/api-info-test.json index 946f9f29..a7e03f7b 100644 --- a/tests/schemas/api-info-test.json +++ b/tests/schemas/api-info-test.json @@ -14,7 +14,6 @@ } }, "host": "petstore.swagger.io", - "basePath": "/v2/", "schemes": ["http"], "paths": { "/pet": {