Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] develop from postmanlabs:develop #67

Merged
merged 75 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
17a9b1e
Bump json5 from 2.2.0 to 2.2.3
dependabot[bot] Jan 7, 2023
8088877
Bump semver from 5.7.1 to 5.7.2
dependabot[bot] Jul 13, 2023
da22544
Bump word-wrap from 1.2.3 to 1.2.4
dependabot[bot] Jul 20, 2023
e8046bc
Fixed an issue where schemas under allOf keyword having additionalPro…
VShingala Mar 26, 2024
ae1bf3e
Merge pull request #787 from postmanlabs/feature/fix-allof-additional…
VShingala Mar 27, 2024
3e1e4e8
Prepare release v4.20.1
web-flow Mar 27, 2024
0128b3d
Added changelogs
VShingala Mar 27, 2024
228c462
Merge pull request #789 from postmanlabs/release/v4.20.1
VShingala Mar 27, 2024
c12e738
Added simplified request and response body matching in case of multip…
VShingala May 14, 2024
87cf696
Added comments for req-res matching for multi examples
VShingala May 14, 2024
4d94c7e
Added tests for updated multi example support
VShingala May 14, 2024
eb3cc5e
Use only correct content type request body examples to generate colle…
VShingala May 14, 2024
e90b218
Merge pull request #792 from postmanlabs/feature/fix-multi-examples-m…
VShingala May 17, 2024
799d3c7
Prepare release v4.21.0
web-flow May 17, 2024
a2c3651
Added changelogs
VShingala May 17, 2024
ddf71ae
Merge pull request #794 from postmanlabs/release/v4.21.0
VShingala May 17, 2024
489e6d3
Fixed an issue where duplicate collection variables were generated fo…
VShingala Jun 24, 2024
cfa5aa9
Merge pull request #796 from postmanlabs/feature/fix-duplicate-collec…
VShingala Jun 25, 2024
b45622b
Added support for response code based multi example matching
VShingala Jul 4, 2024
eb0f269
Added more comments to describe the response code matching logic
VShingala Jul 8, 2024
0427866
Merge pull request #797 from postmanlabs/feature/fix-multi-example-re…
VShingala Jul 8, 2024
edde29b
Updated postman-collection require to be limited to usage of it
VShingala Jul 9, 2024
b15aaee
Fixed failing system tests to also allow minor patch versions in pack…
VShingala Jul 9, 2024
fae8a75
Merge pull request #798 from postmanlabs/feature/update-postman-colle…
VShingala Jul 10, 2024
11015be
Prepare release v4.22.0
web-flow Jul 10, 2024
bbe6ad8
Update CHANGELOG.md
VShingala Jul 10, 2024
1c2c120
Merge pull request #800 from postmanlabs/release/v4.22.0
VShingala Jul 10, 2024
259c274
Conversion - Added option to set preferred request body content-type
thim81 Jul 11, 2024
5708d0e
Added option to set preferred request body content-type
thim81 Jul 11, 2024
c2be837
Added option to set preferred request body content-type
thim81 Jul 11, 2024
f11b84a
Added option to set preferred request body content-type
thim81 Jul 11, 2024
f8ce239
Added option to set preferred request body content-type
thim81 Jul 11, 2024
516c342
Added option to set preferred request body content-type
thim81 Jul 11, 2024
35ece65
Added option to set preferred request body content-type
thim81 Jul 11, 2024
3d69abf
Added option to set preferred request body content-type
thim81 Jul 11, 2024
59cc548
Added option to set preferred request body content-type
thim81 Jul 11, 2024
8b8c473
Added option to set preferred request body content-type
thim81 Jul 11, 2024
4be1a1c
Added option to set preferred request body content-type
thim81 Jul 12, 2024
fa60724
Added option to set preferred request body content-type
thim81 Jul 12, 2024
822b770
Fixed issue with getOptions() API where default module version was st…
VShingala Jul 15, 2024
930197a
Merge pull request #804 from postmanlabs/feature/fix-default-module-v…
VShingala Jul 15, 2024
04a4527
preferredRequestBodyType option- Set default to 'first-listed"
thim81 Jul 15, 2024
717dbb0
preferredRequestBodyType option- Set default to 'first-listed" and re…
thim81 Jul 15, 2024
b883271
Update OPTIONS.md to include external: false options
thim81 Jul 15, 2024
fec6268
Merge pull request #803 from thim81/develop-801-request-contenttype-body
VShingala Jul 16, 2024
c753ff0
Fix to convert "format:binary "to type:"file
thim81 Jul 16, 2024
84f8011
Added support for readOnly and writeOnly keywords with v2 APIs
VShingala Jul 18, 2024
5a8a889
Added support for file type filed for form-data body
VShingala Jul 18, 2024
adebab9
Merge pull request #805 from thim81/develop-795-binary-format
VShingala Jul 19, 2024
c6b3852
Added better support for readOnly and writeOnly path via usage of jso…
VShingala Jul 19, 2024
672fef9
Replace traverse with neotraverse
wojtekmaj Jul 16, 2024
d63eb15
Merge pull request #745 from postmanlabs/dependabot/npm_and_yarn/word…
VShingala Jul 22, 2024
b9f7ba4
Merge pull request #744 from postmanlabs/dependabot/npm_and_yarn/semv…
VShingala Jul 22, 2024
96eb6d5
Merge pull request #667 from postmanlabs/dependabot/npm_and_yarn/json…
VShingala Jul 22, 2024
7b67a52
Merge pull request #806 from wojtekmaj/neotraverse
VShingala Jul 22, 2024
c8af735
Prepare release v4.23.0
web-flow Jul 22, 2024
cde7edd
Update CHANGELOG.md
VShingala Jul 22, 2024
88c2dcc
Merge pull request #811 from postmanlabs/release/v4.23.0
VShingala Jul 22, 2024
1fca957
Revert "Replace traverse with neotraverse"
VShingala Jul 22, 2024
8dde366
Merge pull request #812 from postmanlabs/revert-806-neotraverse
VShingala Jul 22, 2024
8ffd040
Prepare release v4.23.1
web-flow Jul 22, 2024
5267cb9
Update CHANGELOG.md
VShingala Jul 22, 2024
81aca56
Merge pull request #814 from postmanlabs/release/v4.23.1
VShingala Jul 22, 2024
38ad4e9
Replace traverse with neotraverse
VShingala Jul 22, 2024
3eddcaa
Update neotraverse to latest version
VShingala Jul 22, 2024
34f299e
Merge pull request #815 from postmanlabs/feature/use-neotraverse
VShingala Jul 22, 2024
a0aa439
Merge branch 'develop' of github.com:postmanlabs/openapi-to-postman i…
VShingala Aug 9, 2024
083b837
Merge pull request #807 from postmanlabs/feature/readonly-writeonly-s…
VShingala Aug 13, 2024
d51ec4c
Prepare release v4.24.0
web-flow Aug 13, 2024
58d8f83
Update CHANGELOG.md
VShingala Aug 13, 2024
54e9c8a
Merge pull request #822 from postmanlabs/release/v4.24.0
VShingala Aug 13, 2024
11d5611
Fix undefined example.$ref
thim81 Sep 9, 2024
7f9f85c
Throw fatal error to allow error handling in module usage
thim81 Sep 9, 2024
af57d1c
Revert back
thim81 Sep 9, 2024
f0a23b1
Merge pull request #825 from thim81/824-empty-example
VShingala Sep 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 50 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,45 @@

## [Unreleased]

## [v4.24.0] - 2024-08-13

### Added

- [#98](https://github.com/postmanlabs/openapi-to-postman/issues/98) [12255](https://github.com/postmanlabs/postman-app-support/issues/12255) Added support for readOnly and writeOnly properties to be correctly present in generated collection.

### Chore

- Replaced traverse with neotraverse.

## [v4.23.1] - 2024-07-22

### Added

- Conversion - Added option to set preferred request body content-type and use the first mentioned content-type as request body.

### Fixed

- Fixed issue with getOptions() API where default module version was still v1.
- Fix to convert "format:binary" to "type:file" for requests with formdata body.

## [v4.22.0] - 2024-07-10

### Chore

- Updated postman-collection to v4.4.0.

## [v4.21.0] - 2024-05-17

### Added

- Added support for simplified request and response body matching in case of multiple examples.

## [v4.20.1] - 2024-03-27

### Fixed

- Fixed an issue where schemas under allOf keyword having additionalProperties set to false were not generating bodies correctly.

## [v4.20.0] - 2024-02-15

### Added
Expand Down Expand Up @@ -608,7 +647,17 @@ Newer releases follow the [Keep a Changelog](https://keepachangelog.com/en/1.0.0

- Base release

[Unreleased]: https://github.com/postmanlabs/openapi-to-postman/compare/v4.20.0...HEAD
[Unreleased]: https://github.com/postmanlabs/openapi-to-postman/compare/v4.24.0...HEAD

[v4.24.0]: https://github.com/postmanlabs/openapi-to-postman/compare/v4.23.1...v4.24.0

[v4.23.1]: https://github.com/postmanlabs/openapi-to-postman/compare/v4.22.0...v4.23.1

[v4.22.0]: https://github.com/postmanlabs/openapi-to-postman/compare/v4.21.0...v4.22.0

[v4.21.0]: https://github.com/postmanlabs/openapi-to-postman/compare/v4.20.1...v4.21.0

[v4.20.1]: https://github.com/postmanlabs/openapi-to-postman/compare/v4.20.0...v4.20.1

[v4.20.0]: https://github.com/postmanlabs/openapi-to-postman/compare/v4.19.0...v4.20.0

Expand Down
6 changes: 6 additions & 0 deletions OPTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ collapseFolders|boolean|-|true|Importing will collapse all folders that have onl
optimizeConversion|boolean|-|true|Optimizes conversion for large specification, disabling this option might affect the performance of conversion.|CONVERSION|v1
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
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
disabledParametersValidation|boolean|-|true|Whether disabled parameters of collection should be validated|VALIDATION|v2, v1
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
folderStrategy|enum|Paths, Tags|Paths|Select whether to create folders according to the spec’s paths or tags.|CONVERSION|v2, v1
schemaFaker|boolean|-|true|Whether or not schemas should be faked.|CONVERSION|v2, v1
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|v2, v1
includeAuthInfoInExample|boolean|-|true|Select whether to include authentication parameters in the example request.|CONVERSION|v2, v1
shortValidationErrors|boolean|-|false|Whether detailed error messages are required for request <> schema validation operations.|VALIDATION|v2, v1
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
Expand All @@ -20,5 +23,8 @@ strictRequestMatching|boolean|-|false|Whether requests should be strictly matche
allowUrlPathVarMatching|boolean|-|false|Whether to allow matching path variables that are available as part of URL itself in the collection request|VALIDATION|v2, v1
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|v2, v1
keepImplicitHeaders|boolean|-|false|Whether to keep implicit headers from the OpenAPI specification, which are removed by default.|CONVERSION|v2, v1
includeWebhooks|boolean|-|false|Select whether to include Webhooks in the generated collection|CONVERSION|v2, v1
includeReferenceMap|boolean|-|false|Whether or not to include reference map or not as part of output|BUNDLE|v2, v1
includeDeprecated|boolean|-|true|Select whether to include deprecated operations, parameters, and properties in generated collection or not|CONVERSION, VALIDATION|v2, v1
alwaysInheritAuthentication|boolean|-|false|Whether authentication details should be included on every request, or always inherited from the collection.|CONVERSION|v2, v1
preferredRequestBodyType|enum|x-www-form-urlencoded, form-data, raw, first-listed|first-listed|When there are multiple content-types defined in the request body of OpenAPI, the conversion selects the preferred option content-type as request body.If "first-listed" is set, the first content-type defined in the OpenAPI spec will be selected.|CONVERSION|v2
2 changes: 1 addition & 1 deletion lib/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const _ = require('lodash'),
jsonPointerDecodeAndReplace,
generateObjectName
} = require('./jsonPointer'),
traverseUtility = require('traverse'),
traverseUtility = require('neotraverse/legacy'),
parse = require('./parse.js'),
{ ParseError } = require('./common/ParseError'),
Utils = require('./utils'),
Expand Down
7 changes: 4 additions & 3 deletions lib/common/versionUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,10 @@ function getSpecVersion({ type, data, specificationVersion }) {
const openapi30 = getVersionRegexp(VERSION_30),
openapi31 = getVersionRegexp(VERSION_31),
openapi20 = getVersionRegexp(VERSION_20),
is30 = data.match(openapi30),
is31 = data.match(openapi31),
is20 = data.match(openapi20);
is30 = typeof data === 'string' && data.match(openapi30),
is31 = typeof data === 'string' && data.match(openapi31),
is20 = typeof data === 'string' && data.match(openapi20);

let version = DEFAULT_SPEC_VERSION;

if (is30) {
Expand Down
4 changes: 3 additions & 1 deletion lib/deref.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const _ = require('lodash'),
isAllOf: false
},
DEFAULT_SCHEMA_UTILS = require('./30XUtils/schemaUtils30X'),
traverseUtility = require('traverse'),
traverseUtility = require('neotraverse/legacy'),
PROPERTIES_TO_ASSIGN_ON_CASCADE = ['type', 'nullable'];

/**
Expand Down Expand Up @@ -131,6 +131,8 @@ module.exports = {
{ stack, seenRef: _.cloneDeep(seenRef), resolveFor, resolveTo, stackLimit, isAllOf: true, analytics });
})
}), {
// below option is required to make sure schemas with additionalProperties set to false are resolved correctly
ignoreAdditionalProperties: true,
resolvers: {
// for keywords in OpenAPI schema that are not standard defined JSON schema keywords, use default resolver
defaultResolver: (compacted) => { return compacted[0]; },
Expand Down
26 changes: 21 additions & 5 deletions lib/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,12 @@ module.exports = {
*
* @param {string} [mode='document'] Describes use-case. 'document' will return an array
* with all options being described. 'use' will return the default values of all options
* @param {Object} criteria Decribes required criteria for options to be returned. can have properties
* external: <boolean>
* usage: <array> (Array of supported usage type - CONVERSION, VALIDATION)
* version: <string> ('3.0' by default, supported values: '3.0', '3.1')
* @param {Object} criteria Decribes required criteria for options to be returned.
* @param {string} criteria.version The version of the OpenAPI spec to be converted
* (can be one of '2.0', '3.0', '3.1')
* @param {string} criteria.moduleVersion The version of the module (can be one of 'v1' or 'v2')
* @param {Array<string>} criteria.usage The usage of the option (values can be one of 'CONVERSION', 'VALIDATION')
* @param {boolean} criteria.external Whether the option is exposed to Postman App UI or not
* @returns {mixed} An array or object (depending on mode) that describes available options
*/
getOptions: function(mode = 'document', criteria = {}) {
Expand Down Expand Up @@ -386,6 +388,20 @@ module.exports = {
usage: ['CONVERSION'],
supportedIn: [VERSION20, VERSION30, VERSION31],
supportedModuleVersion: [MODULE_VERSION.V2, MODULE_VERSION.V1]
},
{
name: 'Select request body type',
id: 'preferredRequestBodyType',
type: 'enum',
default: 'first-listed',
availableOptions: ['x-www-form-urlencoded', 'form-data', 'raw', 'first-listed'],
description: 'When there are multiple content-types defined in the request body of OpenAPI, the conversion ' +
'selects the preferred option content-type as request body.If "first-listed" is set, the first ' +
'content-type defined in the OpenAPI spec will be selected.',
external: false,
usage: ['CONVERSION'],
supportedIn: [VERSION20, VERSION30, VERSION31],
supportedModuleVersion: [MODULE_VERSION.V2]
}
];

Expand All @@ -408,7 +424,7 @@ module.exports = {
}

// Setting default value
criteria.moduleVersion = _.has(criteria, 'moduleVersion') ? criteria.moduleVersion : MODULE_VERSION.V1;
criteria.moduleVersion = _.has(criteria, 'moduleVersion') ? criteria.moduleVersion : MODULE_VERSION.V2;

if (!_.includes(option.supportedModuleVersion, criteria.moduleVersion)) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion lib/relatedFiles.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const parse = require('./parse.js'),
traverseUtility = require('traverse'),
traverseUtility = require('neotraverse/legacy'),
BROWSER = 'browser',
{ DFS } = require('./dfs'),
{ isExtRef, removeLocalReferenceFromPath } = require('./jsonPointer');
Expand Down
Loading
Loading