mirror of
https://github.com/postmanlabs/openapi-to-postman.git
synced 2022-11-29 22:05:00 +03:00
Merge pull request #275 from postmanlabs/feature/fix-root-path-mismatch
Fixed issue where root path was not matched during validation.
This commit is contained in:
@@ -3616,6 +3616,15 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// handle root path '/'
|
||||||
|
if (postmanPath === '/' && schemaPath === '/') {
|
||||||
|
anyMatchFound = true;
|
||||||
|
maxScoreFound = 1; // assign max possible score
|
||||||
|
matchedPathVars = []; // no path variables present
|
||||||
|
fixedMatchedSegments = 0;
|
||||||
|
variableMatchedSegments = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (anyMatchFound) {
|
if (anyMatchFound) {
|
||||||
return {
|
return {
|
||||||
match: true,
|
match: true,
|
||||||
|
|||||||
@@ -2136,3 +2136,15 @@ describe('convertToPmQueryArray function', function() {
|
|||||||
expect(result[1]).to.equal('variable3=456%20456');
|
expect(result[1]).to.equal('variable3=456%20456');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('getPostmanUrlSchemaMatchScore function', function() {
|
||||||
|
it('Should correctly match root level path with matching request endpoint', function () {
|
||||||
|
let schemaPath = '/',
|
||||||
|
pmPath = '/',
|
||||||
|
endpointMatchScore = SchemaUtils.getPostmanUrlSchemaMatchScore(schemaPath, pmPath, {});
|
||||||
|
|
||||||
|
// root level paths should match with max score
|
||||||
|
expect(endpointMatchScore.match).to.eql(true);
|
||||||
|
expect(endpointMatchScore.score).to.eql(1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user