diff --git a/lib/components/ApiInfo/api-info.html b/lib/components/ApiInfo/api-info.html index 725de4e96a..294517b902 100644 --- a/lib/components/ApiInfo/api-info.html +++ b/lib/components/ApiInfo/api-info.html @@ -1,6 +1,6 @@

{{info.title}} ({{info.version}})

-

+

Download OpenAPI (fka Swagger) specification: Download

diff --git a/lib/components/ApiInfo/api-info.ts b/lib/components/ApiInfo/api-info.ts index 2138a64add..d04423c425 100644 --- a/lib/components/ApiInfo/api-info.ts +++ b/lib/components/ApiInfo/api-info.ts @@ -23,7 +23,7 @@ export class ApiInfo extends BaseComponent implements OnInit { init() { this.info = this.componentSchema.info; - this.specUrl = this.optionsService.options.specUrl; + this.specUrl = this.specMgr.specUrl; if (!isNaN(parseInt(this.info.version.toString().substring(0, 1)))) { this.info.version = 'v' + this.info.version; } diff --git a/lib/utils/spec-manager.ts b/lib/utils/spec-manager.ts index 43118bbaf9..084cf22b98 100644 --- a/lib/utils/spec-manager.ts +++ b/lib/utils/spec-manager.ts @@ -32,7 +32,7 @@ export class SpecManager { public basePath: string; public spec = new BehaviorSubject(null); - public _specUrl: string; + public specUrl: string; private parser: any; private options: Options; @@ -46,7 +46,7 @@ export class SpecManager { this.parser.bundle(urlOrObject, {http: {withCredentials: false}}) .then(schema => { if (typeof urlOrObject === 'string') { - this._specUrl = urlOrObject; + this.specUrl = urlOrObject; } this._schema = snapshot(schema); try { @@ -64,7 +64,7 @@ export class SpecManager { /* calculate common used values */ init() { - let urlParts = this._specUrl ? urlParse(urlResolve(window.location.href, this._specUrl)) : {}; + let urlParts = this.specUrl ? urlParse(urlResolve(window.location.href, this.specUrl)) : {}; let schemes = this._schema.schemes; let protocol; if (!schemes || !schemes.length) { diff --git a/tests/unit/SpecManager.spec.ts b/tests/unit/SpecManager.spec.ts index a0089d2019..5872c32e97 100644 --- a/tests/unit/SpecManager.spec.ts +++ b/tests/unit/SpecManager.spec.ts @@ -46,21 +46,21 @@ describe('Utils', () => { it('should substitute api scheme when spec schemes are undefined', () => { specMgr._schema.schemes = undefined; - specMgr._specUrl = 'https://petstore.swagger.io/v2'; + specMgr.specUrl = 'https://petstore.swagger.io/v2'; specMgr.init(); specMgr.apiUrl.should.be.equal('https://petstore.swagger.io/v2'); }); it('should substitute api host when spec host is undefined', () => { specMgr._schema.host = undefined; - specMgr._specUrl = 'http://petstore.swagger.io/v2'; + specMgr.specUrl = 'http://petstore.swagger.io/v2'; specMgr.init(); specMgr.apiUrl.should.be.equal('http://petstore.swagger.io/v2'); }); it('should use empty basePath when basePath is not present', () => { specMgr._schema.basePath = undefined; - specMgr._specUrl = 'https://petstore.swagger.io'; + specMgr.specUrl = 'https://petstore.swagger.io'; specMgr.init(); specMgr.basePath.should.be.equal(''); });