diff --git a/README.md b/README.md index 7c2eb928..5b76db06 100644 --- a/README.md +++ b/README.md @@ -212,7 +212,6 @@ You can use all of the following options with the standalone version of the { }, } as any; - const opts = new RedocNormalizedOptions({ downloadFileName: 'filename.json' }); + const opts = new RedocNormalizedOptions({ + downloadDefinitionUrl: 'https:test.com/filename.yaml', + }); const info = new ApiInfoModel(parser, opts); - expect(info.downloadFileName).toEqual('filename.json'); + expect(info.downloadFileName).toEqual(undefined); }); }); }); diff --git a/src/services/models/ApiInfo.ts b/src/services/models/ApiInfo.ts index e9172443..b5d71802 100644 --- a/src/services/models/ApiInfo.ts +++ b/src/services/models/ApiInfo.ts @@ -34,6 +34,10 @@ export class ApiInfoModel implements OpenAPIInfo { } private getDownloadLink(): string | undefined { + if (this.options.downloadDefinitionUrl) { + return this.options.downloadDefinitionUrl; + } + if (this.parser.specUrl) { return this.parser.specUrl; } @@ -47,8 +51,8 @@ export class ApiInfoModel implements OpenAPIInfo { } private getDownloadFileName(): string | undefined { - if (!this.parser.specUrl) { - return this.options.downloadFileName; + if (!this.parser.specUrl && !this.options.downloadDefinitionUrl) { + return 'openapi.json'; } return undefined; }