openapi-to-postmanv2
Advanced tools
Comparing version 4.9.0-beta.9 to 4.9.0-beta.10
@@ -21,2 +21,6 @@ const generateAuthForCollectionFromOpenAPI = require('./helpers/collection/generateAuthForCollectionFromOpenAPI'); | ||
}, | ||
PARAMTER_RESOLUTION_TYPE = { | ||
SCHEMA: 'schema', | ||
VALUE: 'value' | ||
}, | ||
HEADER_TYPE_PREVIEW_LANGUAGE_MAP = { | ||
@@ -206,3 +210,5 @@ [HEADER_TYPE.JSON]: 'json', | ||
*/ | ||
resolveRefFromSchema = (context, $ref, stackDepth = 0, resolveFor = CONVERSION, seenRef = {}) => { | ||
resolveRefFromSchema = (context, $ref, stackDepth = 0, | ||
resolveFor = CONVERSION, seenRef = {}, resolveTo = PARAMTER_RESOLUTION_TYPE.SCHEMA | ||
) => { | ||
const { specComponents } = context; | ||
@@ -251,7 +257,7 @@ | ||
if (!resolvedSchema) { | ||
if (resolvedSchema === undefined) { | ||
return { value: 'reference ' + $ref + ' not found in the OpenAPI spec' }; | ||
} | ||
if (resolvedSchema.$ref) { | ||
if (_.has(resolvedSchema, '$ref')) { | ||
if (seenRef[resolvedSchema.$ref]) { | ||
@@ -265,2 +271,6 @@ return { | ||
if (resolveTo === PARAMTER_RESOLUTION_TYPE.VALUE) { | ||
return resolvedSchema; | ||
} | ||
// eslint-disable-next-line no-use-before-define | ||
@@ -528,2 +538,14 @@ resolvedSchema = resolveSchema(context, resolvedSchema, stackDepth, resolveFor, _.cloneDeep(seenRef)); | ||
// Resolve refs inside enums to value | ||
if (schema.hasOwnProperty('enum')) { | ||
_.forEach(schema.enum, (item, index) => { | ||
if (item && item.hasOwnProperty('$ref')) { | ||
schema.enum[index] = resolveRefFromSchema( | ||
context, item.$ref, stack, resolveFor, | ||
_.cloneDeep(seenRef), PARAMTER_RESOLUTION_TYPE.VALUE | ||
); | ||
} | ||
}); | ||
} | ||
return schema; | ||
@@ -530,0 +552,0 @@ }, |
{ | ||
"name": "openapi-to-postmanv2", | ||
"version": "4.9.0-beta.9", | ||
"version": "4.9.0-beta.10", | ||
"description": "Convert a given OpenAPI specification to Postman Collection v2.0", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/postmanlabs/openapi-to-postman", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1686650
43281
4