From 14acab32b2ba4f9c79698eb0de7ffc0db4c12e2d Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Fri, 5 Oct 2018 16:43:59 +0300 Subject: [PATCH] chore: minor refactor --- src/services/models/ApiInfo.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/services/models/ApiInfo.ts b/src/services/models/ApiInfo.ts index ceb38d00..4cc831b6 100644 --- a/src/services/models/ApiInfo.ts +++ b/src/services/models/ApiInfo.ts @@ -11,6 +11,9 @@ export class ApiInfoModel implements OpenAPIInfo { contact?: OpenAPIContact; license?: OpenAPILicense; + downloadLink?: string; + downloadFileName?: string; + constructor(private parser: OpenAPIParser) { Object.assign(this, parser.spec.info); this.description = parser.spec.info.description || ''; @@ -18,9 +21,12 @@ export class ApiInfoModel implements OpenAPIInfo { if (firstHeadingLinePos > -1) { this.description = this.description.substring(0, firstHeadingLinePos); } + + this.downloadLink = this.getDownloadLink(); + this.downloadFileName = this.getDownloadFileName(); } - get downloadLink(): string | undefined { + private getDownloadLink(): string | undefined { if (this.parser.specUrl) { return this.parser.specUrl; } @@ -33,7 +39,7 @@ export class ApiInfoModel implements OpenAPIInfo { } } - get downloadFileName(): string | undefined { + private getDownloadFileName(): string | undefined { if (!this.parser.specUrl) { return 'swagger.json'; }