From a33c353a2689db4fb954d3a8df3760f22ce04e3e Mon Sep 17 00:00:00 2001 From: rainmanhhh <410488219@qq.com> Date: Fri, 11 Aug 2023 10:30:40 +0800 Subject: [PATCH] [typescript-rxjs] Update servers.mustache (#9449) * Update servers.mustache add hasOwnProperty checking; use const instead of var * use 4 spaces instead of tabs --- .../src/main/resources/typescript-rxjs/servers.mustache | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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; }