Skip to content

Commit 59e0b70

Browse files
authored
Merge pull request #780 from postmanlabs/release/v4.19.0
Release version v4.19.0
2 parents a6badaa + 193d928 commit 59e0b70

File tree

27 files changed

+287
-113
lines changed

27 files changed

+287
-113
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## [Unreleased]
44

5+
## [v4.19.0] - 2024-01-18
6+
57
## [v4.18.0] - 2023-09-28
68

79
- [#425](https://github.com/postmanlabs/openapi-to-postman/issues/425) [8413](https://github.com/postmanlabs/postman-app-support/issues/8413) Added support for multiple request and response examples.
@@ -600,7 +602,9 @@ Newer releases follow the [Keep a Changelog](https://keepachangelog.com/en/1.0.0
600602

601603
- Base release
602604

603-
[Unreleased]: https://github.com/postmanlabs/openapi-to-postman/compare/v4.18.0...HEAD
605+
[Unreleased]: https://github.com/postmanlabs/openapi-to-postman/compare/v4.19.0...HEAD
606+
607+
[v4.19.0]: https://github.com/postmanlabs/openapi-to-postman/compare/v4.18.0...v4.19.0
604608

605609
[v4.18.0]: https://github.com/postmanlabs/openapi-to-postman/compare/v4.17.0...v4.18.0
606610

assets/json-schema-faker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10919,7 +10919,7 @@ module.exports = {
1091910919
*/
1092010920
parse: function yamlParse (text, reviver) {
1092110921
try {
10922-
return yaml.safeLoad(text);
10922+
return yaml.load(text);
1092310923
}
1092410924
catch (e) {
1092510925
if (e instanceof Error) {

examples/sampleswagger.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,20 @@ info:
1414
email: apiteam@wordnik.com
1515
license:
1616
name: Apache 2.0
17-
url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
17+
url: http://www.apache.org/licenses/LICENSE-2.0.html
1818
tags:
1919
- name: pet
2020
description: Everything about your Pets
2121
externalDocs:
2222
description: Find out more
23-
url: 'http://swagger.io'
23+
url: http://swagger.io
2424
- name: store
2525
description: Operations about user
2626
- name: user
2727
description: Access to Petstore orders
2828
externalDocs:
2929
description: Find out more about our store
30-
url: 'http://swagger.io'
30+
url: http://swagger.io
3131
paths:
3232
/pet:
3333
post:
@@ -542,7 +542,7 @@ paths:
542542
description: User not found
543543
externalDocs:
544544
description: Find out more about Swagger
545-
url: 'http://swagger.io'
545+
url: http://swagger.io
546546
components:
547547
requestBodies:
548548
UserArray:
@@ -688,4 +688,4 @@ components:
688688
message:
689689
type: string
690690
xml:
691-
name: '##default'
691+
name: '##default'

lib/bundle.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -701,12 +701,12 @@ function generateComponentsObject(documentContext, rootContent,
701701
circularRefsSet = new Set();
702702
const { COMPONENTS_KEYS } = getBundleRulesDataByVersion(version);
703703
notInLine.forEach(([key, value]) => {
704-
let [, partial] = key.split(localPointer);
704+
let [nodeRef, partial] = key.split(localPointer);
705705
if (documentContext.globalReferences[key].refHasContent) {
706706
setValueInComponents(
707707
value.keyInComponents,
708708
components,
709-
getContentFromTrace(documentContext.nodeContents[key], partial),
709+
getContentFromTrace(documentContext.nodeContents[nodeRef], partial),
710710
COMPONENTS_KEYS
711711
);
712712
}

lib/deref.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,12 @@ module.exports = {
133133
}), {
134134
resolvers: {
135135
// for keywords in OpenAPI schema that are not standard defined JSON schema keywords, use default resolver
136-
defaultResolver: (compacted) => { return compacted[0]; }
136+
defaultResolver: (compacted) => { return compacted[0]; },
137+
138+
// Default resolver seems to fail for enum, so adding custom resolver that will return all unique enum values
139+
enum: (values) => {
140+
return _.uniq(_.concat(...values));
141+
}
137142
}
138143
});
139144
}

lib/parse.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@ module.exports = {
3333

3434
asYaml: function (spec) {
3535
try {
36-
let obj = yaml.safeLoad(spec, {
36+
let obj = yaml.load(spec, {
3737
schema: yaml.JSON_SCHEMA
3838
});
3939
// yaml.safeLoad does not throw errors for most of the cases in invalid yaml
40+
// yaml.safeLoad is removed in js-yaml 4. Hence Using yaml.load instead, which is now safe by default.
4041
// hence check if it returned an object
4142
if (typeof obj !== 'object') {
4243
throw new Error('');

libV2/schemaUtils.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,10 @@ let QUERYPARAM = 'query',
458458
}), {
459459
resolvers: {
460460
// for keywords in OpenAPI schema that are not standard defined JSON schema keywords, use default resolver
461-
defaultResolver: (compacted) => { return compacted[0]; }
461+
defaultResolver: (compacted) => { return compacted[0]; },
462+
enum: (values) => {
463+
return _.uniq(_.concat(...values));
464+
}
462465
}
463466
});
464467
}

package-lock.json

Lines changed: 78 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "openapi-to-postmanv2",
3-
"version": "4.18.0",
3+
"version": "4.19.0",
44
"description": "Convert a given OpenAPI specification to Postman Collection v2.0",
55
"homepage": "https://github.com/postmanlabs/openapi-to-postman",
66
"bugs": "https://github.com/postmanlabs/openapi-to-postman/issues",
@@ -121,7 +121,7 @@
121121
"ajv-formats": "2.1.1",
122122
"async": "3.2.4",
123123
"commander": "2.20.3",
124-
"js-yaml": "3.14.1",
124+
"js-yaml": "4.1.0",
125125
"json-schema-merge-allof": "0.8.1",
126126
"lodash": "4.17.21",
127127
"oas-resolver-browser": "2.5.6",

0 commit comments

Comments
 (0)