Skip to content

Commit de68836

Browse files
authored
Merge pull request #644 from postmanlabs/feature/fix-request-name-path-spaces
Fixed issue where collection folder name for paths were having extra spaces.
2 parents 74d831b + 92ba7fb commit de68836

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

lib/schemaUtils.js

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

test/unit/base.test.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,6 +1275,22 @@ describe('CONVERT FUNCTION TESTS ', function() {
12751275
done();
12761276
});
12771277
});
1278+
1279+
it('Should generate collection where folder name doesn\'t contain spaces when ' +
1280+
'not present in operation path', function (done) {
1281+
var openapi = fs.readFileSync(testSpec, 'utf8');
1282+
Converter.convert({ type: 'string', data: openapi }, { schemaFaker: true }, (err, conversionResult) => {
1283+
expect(err).to.be.null;
1284+
expect(conversionResult.result).to.equal(true);
1285+
expect(conversionResult.output.length).to.equal(1);
1286+
expect(conversionResult.output[0].type).to.equal('collection');
1287+
expect(conversionResult.output[0].data).to.have.property('info');
1288+
expect(conversionResult.output[0].data).to.have.property('item');
1289+
expect(conversionResult.output[0].data.item.length).to.equal(2);
1290+
expect(_.map(conversionResult.output[0].data.item, 'name')).to.include.members(['pets', 'pet/{petId}']);
1291+
done();
1292+
});
1293+
});
12781294
});
12791295

12801296
describe('Converting swagger 2.0 files', function() {

0 commit comments

Comments
 (0)