mirror of
https://github.com/postmanlabs/openapi-to-postman.git
synced 2022-11-29 22:05:00 +03:00
Add support for url with fragment and servers
Add support for url with fragment and serversAdd support for url with fragment and serversAdd support for url with fragment and servers
This commit is contained in:
@@ -2603,6 +2603,7 @@ module.exports = {
|
||||
matchedPath,
|
||||
matchedPathJsonPath,
|
||||
schemaPathItems = schema.paths,
|
||||
pathToMatchServer,
|
||||
filteredPathItemsArray = [];
|
||||
|
||||
// Return no matches for invalid url (if unable to decode parsed url)
|
||||
@@ -2650,9 +2651,12 @@ module.exports = {
|
||||
// check if path and pathToMatch match (non-null)
|
||||
// check in explicit (local defined) servers
|
||||
if (pathItemObject[method.toLowerCase()].servers) {
|
||||
pathToMatch = this.handleExplicitServersPathToMatch(pathToMatch, path);
|
||||
pathToMatchServer = this.handleExplicitServersPathToMatch(pathToMatch, path);
|
||||
schemaMatchResult = this.getPostmanUrlSchemaMatchScore(pathToMatchServer, path, options);
|
||||
}
|
||||
else {
|
||||
schemaMatchResult = this.getPostmanUrlSchemaMatchScore(pathToMatch, path, options);
|
||||
}
|
||||
schemaMatchResult = this.getPostmanUrlSchemaMatchScore(pathToMatch, path, options);
|
||||
if (!schemaMatchResult.match) {
|
||||
// there was no reasonable match b/w the postman path and this schema path
|
||||
return true;
|
||||
@@ -4446,6 +4450,7 @@ module.exports = {
|
||||
*/
|
||||
handleExplicitServersPathToMatch: function (pathToMatch, schemaPath) {
|
||||
let pathTMatchSlice,
|
||||
fragment = '',
|
||||
schemaPathArr = _.reject(schemaPath.split('/'), (segment) => {
|
||||
return segment === '';
|
||||
}),
|
||||
@@ -4453,12 +4458,16 @@ module.exports = {
|
||||
pathToMatchArr = _.reject(pathToMatch.split('/'), (segment) => {
|
||||
return segment === '';
|
||||
}),
|
||||
pathToMatchSegments = pathToMatchArr.length;
|
||||
pathToMatchSegments = pathToMatchArr.length,
|
||||
fragments = schemaPath.split('#');
|
||||
if (fragments.length > 1) {
|
||||
fragment = '#' + fragments[1];
|
||||
}
|
||||
if (pathToMatchSegments < schemaPathSegments) {
|
||||
return pathToMatch;
|
||||
}
|
||||
pathTMatchSlice = pathToMatchArr.slice(pathToMatchArr.length - schemaPathSegments, pathToMatchArr.length);
|
||||
return pathTMatchSlice.join('/');
|
||||
return pathTMatchSlice.join('/') + fragment;
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user