Skip to content

Commit

Permalink
Merge branch 'release/1.0.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
Vishal Shingala committed Sep 9, 2020
2 parents 2600509 + cda020c commit 43e02be
Show file tree
Hide file tree
Showing 6 changed files with 367 additions and 106 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
language: node_js
node_js:
- "6"
- "7"
- "8"
- "9"
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Swagger2-Postman Changelog
#### v1.0.3 (September 9, 2020)
* Added support for new options added in latest openapi-to-postmanv2.

#### v1.0.2 (May 4, 2020)
* Changed 'Url' to 'URL' in Name requests option

Expand Down
42 changes: 27 additions & 15 deletions lib/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ Converter = {
// set the default value to that option if the user has not defined
if (options[id] === undefined) {
options[id] = definedOptions[id].default;

// ignore case-sensitivity for enum option with type string
if (definedOptions[id].type === 'enum' && _.isString(options[id])) {
options[id] = _.toLower(definedOptions[id].default);
}
continue;
}
// set the default value if the type is unknown
Expand All @@ -37,19 +32,10 @@ Converter = {
}
break;
case 'enum':
// ignore case-sensitivity for string options
if ((definedOptions[id].availableOptions.includes(options[id])) ||
(_.isString(options[id]) &&
_.map(definedOptions[id].availableOptions, _.toLower).includes(_.toLower(options[id])))) {
// Keep option as is
}
else {
if (!definedOptions[id].availableOptions.includes(options[id])) {
options[id] = definedOptions[id].default;
}

// ignore case-sensitivity for string options
_.isString(options[id]) && (options[id] = _.toLower(options[id]));

break;
default:
options[id] = definedOptions[id].default;
Expand Down Expand Up @@ -121,6 +107,15 @@ Converter = {
'persistent folder-level data.',
external: true
},
{
name: 'Optimize conversion',
id: 'optimizeConversion',
type: 'boolean',
default: true,
description: 'Optimizes conversion for large specification, disabling this option might affect' +
' the performance of conversion.',
external: true
},
{
name: 'Request parameter generation',
id: 'requestParametersResolution',
Expand All @@ -144,6 +139,23 @@ Converter = {
' [example](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#exampleObject)' +
' in the schema.',
external: true
},
{
name: 'Folder organization',
id: 'folderStrategy',
type: 'enum',
default: 'Paths',
availableOptions: ['Paths', 'Tags'],
description: 'Select whether to create folders according to the spec’s paths or tags.',
external: true
},
{
name: 'Include auth info in example requests',
id: 'includeAuthInfoInExample',
type: 'boolean',
default: true,
description: 'Select whether to include authentication parameters in the example request',
external: true
}
];
},
Expand Down
Loading

0 comments on commit 43e02be

Please sign in to comment.