Merge pull request #644 from postmanlabs/feature/fix-request-name-path-spaces

Fixed issue where collection folder name for paths were having extra spaces.
This commit is contained in:
Vishal Shingala
2022-11-25 14:14:03 +05:30
committed by GitHub
2 changed files with 17 additions and 1 deletions

View File

@@ -990,7 +990,7 @@ module.exports = {
// only return a Postman folder if this folder has>1 children in its subtree
// otherwise we can end up with 10 levels of folders with 1 request in the end
itemGroup = new sdk.ItemGroup({
name: utils.insertSpacesInName(resource.name)
name: resource.name
// TODO: have to add auth here (but first, auth to be put into the openapi tree)
});
// If a folder has only one child which is a folder then we collapsed the child folder

View File

@@ -1275,6 +1275,22 @@ describe('CONVERT FUNCTION TESTS ', function() {
done();
});
});
it('Should generate collection where folder name doesn\'t contain spaces when ' +
'not present in operation path', function (done) {
var openapi = fs.readFileSync(testSpec, 'utf8');
Converter.convert({ type: 'string', data: openapi }, { schemaFaker: true }, (err, conversionResult) => {
expect(err).to.be.null;
expect(conversionResult.result).to.equal(true);
expect(conversionResult.output.length).to.equal(1);
expect(conversionResult.output[0].type).to.equal('collection');
expect(conversionResult.output[0].data).to.have.property('info');
expect(conversionResult.output[0].data).to.have.property('item');
expect(conversionResult.output[0].data.item.length).to.equal(2);
expect(_.map(conversionResult.output[0].data.item, 'name')).to.include.members(['pets', 'pet/{petId}']);
done();
});
});
});
describe('Converting swagger 2.0 files', function() {