Skip to content

Commit 9b0a322

Browse files
committed
Merge branch 'release/4.10.1'
2 parents 14bc40b + 05f8f0d commit 9b0a322

File tree

8 files changed

+128
-89
lines changed

8 files changed

+128
-89
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# OpenAPI-Postman Changelog
22

3+
#### v4.10.1 (March 09, 2023)
4+
* Fixed issue where request name generated were not validated correctly.
5+
* Fixed test where getOptions() was not using criteria correctly.
6+
* Fixed issue where deprecated params were reported missing even for includeDeprecated=false
7+
38
#### v4.10.0 (March 08, 2023)
49
* Added support for convertV2() interface which has more stacklimit for schema resolution.
510
* Added support for validateTransactionV2() interface uses same v2 interface for resolving schema.

OPTIONS.md

Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,23 @@
1-
id|type|available options|default|description|usage
2-
|---|---|---|---|---|---|
3-
requestNameSource|enum|URL, Fallback|Fallback|Determines how the requests inside the generated collection will be named. If “Fallback” is selected, the request will be named after one of the following schema values: `summary`, `operationId`, `description`, `url`.|CONVERSION, VALIDATION
4-
indentCharacter|enum|Space, Tab|Space|Option for setting indentation character.|CONVERSION
5-
collapseFolders|boolean|-|true|Importing will collapse all folders that have only one child element and lack persistent folder-level data.|CONVERSION
6-
optimizeConversion|boolean|-|true|Optimizes conversion for large specification, disabling this option might affect the performance of conversion.|CONVERSION
7-
requestParametersResolution|enum|Example, Schema|Schema|Select whether to generate the request parameters based on the [schema](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#schemaObject) or the [example](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#exampleObject) in the schema.|CONVERSION
8-
exampleParametersResolution|enum|Example, Schema|Example|Select whether to generate the response parameters based on the [schema](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#schemaObject) or the [example](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#exampleObject) in the schema.|CONVERSION
9-
disabledParametersValidation|boolean|-|true|Whether disabled parameters of collection should be validated|VALIDATION
10-
parametersResolution|enum|Example, Schema|Schema|Select whether to generate the request and response parameters based on the [schema](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#schemaObject) or the [example](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#exampleObject) in the schema.|CONVERSION
11-
folderStrategy|enum|Paths, Tags|Paths|Select whether to create folders according to the spec’s paths or tags.|CONVERSION
12-
schemaFaker|boolean|-|true|Whether or not schemas should be faked.|CONVERSION
13-
stackLimit|integer|-|10|Number of nesting limit till which schema resolution will happen. Increasing this limit may result in more time to convert collection depending on complexity of specification. (To make sure this option works correctly "optimizeConversion" option needs to be disabled)|CONVERSION
14-
includeAuthInfoInExample|boolean|-|true|Select whether to include authentication parameters in the example request.|CONVERSION
15-
shortValidationErrors|boolean|-|false|Whether detailed error messages are required for request <> schema validation operations.|VALIDATION
16-
validationPropertiesToIgnore|array|-|[]|Specific properties (parts of a request/response pair) to ignore during validation. Must be sent as an array of strings. Valid inputs in the array: PATHVARIABLE, QUERYPARAM, HEADER, BODY, RESPONSE_HEADER, RESPONSE_BODY|VALIDATION
17-
showMissingInSchemaErrors|boolean|-|false|MISSING_IN_SCHEMA indicates that an extra parameter was included in the request. For most use cases, this need not be considered an error.|VALIDATION
18-
detailedBlobValidation|boolean|-|false|Determines whether to show detailed mismatch information for application/json content in the request/response body.|VALIDATION
19-
suggestAvailableFixes|boolean|-|false|Whether to provide fixes for patching corresponding mismatches.|VALIDATION
20-
validateMetadata|boolean|-|false|Whether to show mismatches for incorrect name and description of request|VALIDATION
21-
ignoreUnresolvedVariables|boolean|-|false|Whether to ignore mismatches resulting from unresolved variables in the Postman request|VALIDATION
22-
strictRequestMatching|boolean|-|false|Whether requests should be strictly matched with schema operations. Setting to true will not include any matches where the URL path segments don't match exactly.|VALIDATION
23-
allowUrlPathVarMatching|boolean|-|false|Whether to allow matching path variables that are available as part of URL itself in the collection request|VALIDATION
24-
enableOptionalParameters|boolean|-|true|Optional parameters aren't selected in the collection. Once enabled they will be selected in the collection and request as well.|CONVERSION
25-
keepImplicitHeaders|boolean|-|false|Whether to keep implicit headers from the OpenAPI specification, which are removed by default.|CONVERSION
26-
includeWebhooks|boolean|-|false|Select whether to include Webhooks in the generated collection|CONVERSION
27-
includeReferenceMap|boolean|-|false|Whether or not to include reference map or not as part of output|BUNDLE
28-
includeDeprecated|boolean|-|true|Select whether to include deprecated operations, parameters, and properties in generated collection or not|CONVERSION, VALIDATION
1+
id|type|available options|default|description|usage|version
2+
|---|---|---|---|---|---|---|
3+
requestNameSource|enum|URL, Fallback|Fallback|Determines how the requests inside the generated collection will be named. If “Fallback” is selected, the request will be named after one of the following schema values: `summary`, `operationId`, `description`, `url`.|CONVERSION, VALIDATION|v2, v1
4+
indentCharacter|enum|Space, Tab|Space|Option for setting indentation character.|CONVERSION|v2, v1
5+
collapseFolders|boolean|-|true|Importing will collapse all folders that have only one child element and lack persistent folder-level data.|CONVERSION|v1
6+
optimizeConversion|boolean|-|true|Optimizes conversion for large specification, disabling this option might affect the performance of conversion.|CONVERSION|v1
7+
requestParametersResolution|enum|Example, Schema|Schema|Select whether to generate the request parameters based on the [schema](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#schemaObject) or the [example](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#exampleObject) in the schema.|CONVERSION|v1
8+
exampleParametersResolution|enum|Example, Schema|Example|Select whether to generate the response parameters based on the [schema](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#schemaObject) or the [example](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#exampleObject) in the schema.|CONVERSION|v1
9+
parametersResolution|enum|Example, Schema|Schema|Select whether to generate the request and response parameters based on the [schema](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#schemaObject) or the [example](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#exampleObject) in the schema.|CONVERSION|v2, v1
10+
folderStrategy|enum|Paths, Tags|Paths|Select whether to create folders according to the spec’s paths or tags.|CONVERSION|v2, v1
11+
includeAuthInfoInExample|boolean|-|true|Select whether to include authentication parameters in the example request.|CONVERSION|v2, v1
12+
shortValidationErrors|boolean|-|false|Whether detailed error messages are required for request <> schema validation operations.|VALIDATION|v2, v1
13+
validationPropertiesToIgnore|array|-|[]|Specific properties (parts of a request/response pair) to ignore during validation. Must be sent as an array of strings. Valid inputs in the array: PATHVARIABLE, QUERYPARAM, HEADER, BODY, RESPONSE_HEADER, RESPONSE_BODY|VALIDATION|v2, v1
14+
showMissingInSchemaErrors|boolean|-|false|MISSING_IN_SCHEMA indicates that an extra parameter was included in the request. For most use cases, this need not be considered an error.|VALIDATION|v2, v1
15+
detailedBlobValidation|boolean|-|false|Determines whether to show detailed mismatch information for application/json content in the request/response body.|VALIDATION|v2, v1
16+
suggestAvailableFixes|boolean|-|false|Whether to provide fixes for patching corresponding mismatches.|VALIDATION|v2, v1
17+
validateMetadata|boolean|-|false|Whether to show mismatches for incorrect name and description of request|VALIDATION|v2, v1
18+
ignoreUnresolvedVariables|boolean|-|false|Whether to ignore mismatches resulting from unresolved variables in the Postman request|VALIDATION|v2, v1
19+
strictRequestMatching|boolean|-|false|Whether requests should be strictly matched with schema operations. Setting to true will not include any matches where the URL path segments don't match exactly.|VALIDATION|v2, v1
20+
allowUrlPathVarMatching|boolean|-|false|Whether to allow matching path variables that are available as part of URL itself in the collection request|VALIDATION|v2, v1
21+
enableOptionalParameters|boolean|-|true|Optional parameters aren't selected in the collection. Once enabled they will be selected in the collection and request as well.|CONVERSION|v1
22+
keepImplicitHeaders|boolean|-|false|Whether to keep implicit headers from the OpenAPI specification, which are removed by default.|CONVERSION|v2, v1
23+
includeDeprecated|boolean|-|true|Select whether to include deprecated operations, parameters, and properties in generated collection or not|CONVERSION, VALIDATION|v2, v1

lib/options.js

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -377,31 +377,34 @@ module.exports = {
377377
}
378378
];
379379

380-
// Filter options based on criteria
381-
if (_.isObject(criteria)) {
382-
typeof criteria.external === 'boolean' && (optsArray = _.filter(optsArray, { external: criteria.external }));
383-
if (_.isArray(criteria.usage)) {
384-
let tempOptsArray = [];
380+
optsArray = _.filter(optsArray, (option) => {
381+
if (option.disabled) { return false; }
385382

386-
_.forEach(criteria.usage, (usageCriteria) => {
387-
tempOptsArray = _.concat(tempOptsArray, _.filter(optsArray, (option) => {
388-
return _.includes(option.usage, usageCriteria);
389-
}));
390-
});
391-
optsArray = tempOptsArray;
392-
}
383+
if (_.isObject(criteria)) {
384+
if (typeof criteria.external === 'boolean' && option.external !== criteria.external) {
385+
return false;
386+
}
393387

394-
if (_.has(criteria, 'moduleVersion')) {
395-
optsArray = _.filter(optsArray, (option) => {
396-
return _.includes(option.supportedModuleVersion, criteria.moduleVersion);
397-
});
398-
}
399-
else {
400-
optsArray = _.filter(optsArray, (option) => {
401-
return _.includes(option.supportedModuleVersion, MODULE_VERSION.V1);
402-
});
388+
if (_.isArray(criteria.usage)) {
389+
/**
390+
* We return return a option if any of the criteria.usage value matches with what is
391+
* available in option.usage
392+
*/
393+
if (_.difference(criteria.usage, option.usage).length === criteria.usage.length) {
394+
return false;
395+
}
396+
}
397+
398+
// Setting default value
399+
criteria.moduleVersion = _.has(criteria, 'moduleVersion') ? criteria.moduleVersion : MODULE_VERSION.V1;
400+
401+
if (!_.includes(option.supportedModuleVersion, criteria.moduleVersion)) {
402+
return false;
403+
}
403404
}
404-
}
405+
406+
return true;
407+
});
405408

406409
if (mode === 'use') {
407410
// options to be used as default kv-pairs
@@ -420,10 +423,6 @@ module.exports = {
420423
return defOptions;
421424
}
422425

423-
// options to be used as documentation
424-
return _.filter(optsArray, (opt) => {
425-
// only return options that are not disabled
426-
return opt.disabled !== true;
427-
});
426+
return optsArray;
428427
}
429428
};

libV2/schemaUtils.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,6 +1512,9 @@ let QUERYPARAM = 'query',
15121512
}
15131513
}
15141514

1515+
// Request name should be max 256 characters so trim if needed.
1516+
reqName = utils.trimRequestName(reqName);
1517+
15151518
return reqName;
15161519
},
15171520

0 commit comments

Comments
 (0)