diff --git a/modules/openapi-generator/src/main/resources/typescript-rxjs/servers.mustache b/modules/openapi-generator/src/main/resources/typescript-rxjs/servers.mustache index 84ef1435f3a..dc676eac20c 100644 --- a/modules/openapi-generator/src/main/resources/typescript-rxjs/servers.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-rxjs/servers.mustache @@ -31,8 +31,10 @@ export class ServerConfiguration { public getUrl(): string { let replacedUrl = this.url; for (const key in this.variableConfiguration) { - var re = new RegExp("{" + key + "}","g"); - replacedUrl = replacedUrl.replace(re, this.variableConfiguration[key]); + if (this.variableConfiguration.hasOwnProperty(key)) { + const re = new RegExp("{" + key + "}","g"); + replacedUrl = replacedUrl.replace(re, this.variableConfiguration[key]); + } } return replacedUrl; }