mirror of
https://github.com/postmanlabs/openapi-to-postman.git
synced 2022-11-29 22:05:00 +03:00
Fixed incorrect handling for explodable parameters for resolution schema
This commit is contained in:
@@ -1483,8 +1483,14 @@ module.exports = {
|
||||
});
|
||||
return pmParams;
|
||||
}
|
||||
|
||||
// handle free-form parameter correctly
|
||||
if (explode && (_.get(param, 'schema.type') === 'object') && _.isEmpty(_.get(param, 'schema.properties'))) {
|
||||
return pmParams;
|
||||
}
|
||||
break;
|
||||
case 'deepObject':
|
||||
if (_.isObject(paramValue)) {
|
||||
_.forOwn(paramValue, (value, key) => {
|
||||
pmParams.push({
|
||||
key: param.name + '[' + key + ']',
|
||||
@@ -1492,6 +1498,7 @@ module.exports = {
|
||||
description
|
||||
});
|
||||
});
|
||||
}
|
||||
return pmParams;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -1483,6 +1483,27 @@ describe('SCHEMA UTILITY FUNCTION TESTS ', function () {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Should convert queryParam with schema {type:object, properties: undefined, explode: true, ', function() {
|
||||
let emptyObjParam = {
|
||||
name: 'empty-obj',
|
||||
in: 'query',
|
||||
description: 'query param',
|
||||
schema: { type: 'object' }
|
||||
};
|
||||
|
||||
it('style:deepObject } to pm param', function (done) {
|
||||
let pmParam = SchemaUtils.convertToPmQueryParameters(_.assign(emptyObjParam, { style: 'deepObject' }));
|
||||
expect(pmParam).to.eql([]);
|
||||
done();
|
||||
});
|
||||
|
||||
it('style:form } to pm param', function (done) {
|
||||
let pmParam = SchemaUtils.convertToPmQueryParameters(_.assign(emptyObjParam, { style: 'form' }));
|
||||
expect(pmParam).to.eql([]);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('convertToPmBody function', function() {
|
||||
|
||||
Reference in New Issue
Block a user