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": {