mirror of
https://github.com/postmanlabs/openapi-to-postman.git
synced 2022-11-29 22:05:00 +03:00
Merge pull request #413 from postmanlabs/issue/379
Set param type in request to `file` if schema type is `string` and format is `binary`
This commit is contained in:
@@ -1701,6 +1701,7 @@ module.exports = {
|
||||
var contentObj, // content is required
|
||||
bodyData,
|
||||
param,
|
||||
originalParam,
|
||||
paramArray = [],
|
||||
updateOptions = {},
|
||||
reqBody = new sdk.RequestBody(),
|
||||
@@ -1832,11 +1833,27 @@ module.exports = {
|
||||
}
|
||||
}
|
||||
|
||||
param = new sdk.FormParam({
|
||||
key: key,
|
||||
value: value,
|
||||
type: 'text'
|
||||
});
|
||||
// Fetch the original param and if it is of type 'string' and format 'binary'
|
||||
// then set the type of FormParam to 'file'
|
||||
originalParam = _.get(contentObj[FORM_DATA], ['schema', 'properties', key]);
|
||||
|
||||
if (originalParam &&
|
||||
originalParam.type === 'string' &&
|
||||
originalParam.format === 'binary'
|
||||
) {
|
||||
param = new sdk.FormParam({
|
||||
key: key,
|
||||
value: '',
|
||||
type: 'file'
|
||||
});
|
||||
}
|
||||
else {
|
||||
param = new sdk.FormParam({
|
||||
key: key,
|
||||
value: value,
|
||||
type: 'text'
|
||||
});
|
||||
}
|
||||
param.description = description;
|
||||
paramArray.push(param);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user