mirror of
https://github.com/postmanlabs/openapi-to-postman.git
synced 2022-11-29 22:05:00 +03:00
Fixed issue where certain parameter were not converted to variables in conversion
This commit is contained in:
@@ -306,11 +306,15 @@ module.exports = {
|
||||
// All complicated logic removed
|
||||
// This simply replaces all instances of {text} with {{text}}
|
||||
// text cannot have any of these 3 chars: /{}
|
||||
// and {text} cannot be followed by a }
|
||||
// {{text}} will not be converted
|
||||
// https://regex101.com/r/9N1520/1
|
||||
return url
|
||||
.replace(/(\{[^\/\{\}]+\})(?!\})/g, '{$1}');
|
||||
|
||||
let replacer = function (match, p1, offset, string) {
|
||||
if (string[offset - 1] === '{' && string[offset + match.length + 1] !== '}') {
|
||||
return match;
|
||||
}
|
||||
return '{' + p1 + '}';
|
||||
};
|
||||
return url.replace(/(\{[^\/\{\}]+\})/g, replacer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user