swagger-client 3.27.5 → 3.27.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -372,7 +372,7 @@ function oas3BaseUrl({
|
|
|
372
372
|
}
|
|
373
373
|
if (selectedServerUrl.includes('{')) {
|
|
374
374
|
// do variable substitution
|
|
375
|
-
const varNames =
|
|
375
|
+
const varNames = extractServerVariableNames(selectedServerUrl);
|
|
376
376
|
varNames.forEach(variable => {
|
|
377
377
|
if (selectedServerObj.variables && selectedServerObj.variables[variable]) {
|
|
378
378
|
// variable is defined in server
|
|
@@ -402,16 +402,9 @@ function buildOas3UrlWithContext(ourUrl = '', contextUrl = '') {
|
|
|
402
402
|
}
|
|
403
403
|
return res[res.length - 1] === '/' ? res.slice(0, -1) : res;
|
|
404
404
|
}
|
|
405
|
-
function
|
|
406
|
-
const
|
|
407
|
-
|
|
408
|
-
let text;
|
|
409
|
-
|
|
410
|
-
// eslint-disable-next-line no-cond-assign
|
|
411
|
-
while (text = re.exec(str)) {
|
|
412
|
-
results.push(text[1]);
|
|
413
|
-
}
|
|
414
|
-
return results;
|
|
405
|
+
function extractServerVariableNames(serverURL) {
|
|
406
|
+
const match = serverURL.matchAll(/\{([^{}]+)}|([^{}]+)/g);
|
|
407
|
+
return Array.from(match, ([, variable]) => variable).filter(Boolean);
|
|
415
408
|
}
|
|
416
409
|
|
|
417
410
|
// Compose the baseUrl ( scheme + host + basePath )
|