openapi-to-postmanv2
Advanced tools
Comparing version 4.9.0-beta.34 to 4.9.0-beta.35
@@ -44,2 +44,11 @@ let _ = require('lodash'), | ||
/** | ||
* /user | ||
* /team | ||
* /hi | ||
* /bye | ||
* | ||
* In this scenario, always create a base folder for the path | ||
* and then add and link the request inside the created folder. | ||
*/ | ||
if (pathSplit.length === 1) { | ||
@@ -61,2 +70,16 @@ let methods = openapi.paths[completePath]; | ||
if (!tree.hasNode(`path:folder:${pathSplit[0]}`)) { | ||
tree.setNode(`path:folder:${pathSplit[0]}`, { | ||
type: 'folder', | ||
meta: { | ||
name: pathSplit[0], | ||
path: pathSplit[0], | ||
pathIdentifier: pathSplit[0] | ||
}, | ||
data: {} | ||
}); | ||
tree.setEdge('root:collection', `path:folder:${pathSplit[0]}`); | ||
} | ||
tree.setNode(`path:request:${pathSplit[0]}:${method}`, { | ||
@@ -72,9 +95,3 @@ type: 'request', | ||
if (tree.hasNode(`path:folder:${pathSplit[0]}`)) { | ||
tree.setEdge(`path:folder:${pathSplit[0]}`, `path:request:${pathSplit[0]}:${method}`); | ||
} | ||
else { | ||
tree.setEdge('root:collection', `path:request:${pathSplit[0]}:${method}`); | ||
} | ||
tree.setEdge(`path:folder:${pathSplit[0]}`, `path:request:${pathSplit[0]}:${method}`); | ||
}); | ||
@@ -104,2 +121,24 @@ } | ||
/** | ||
* If it is the last node, | ||
* it might happen that this exists as a folder. | ||
* | ||
* If yes add a request inside that folder else | ||
* add as a request on the previous path idendified which will be a folder. | ||
*/ | ||
if (!tree.hasNode(`path:folder:${pathIdentifier}`)) { | ||
tree.setNode(`path:folder:${pathIdentifier}`, { | ||
type: 'folder', | ||
meta: { | ||
name: path, | ||
path: path, | ||
pathIdentifier: pathIdentifier | ||
}, | ||
data: {} | ||
}); | ||
tree.setEdge(index === 0 ? 'root:collection' : `path:folder:${previousPathIdentified}`, | ||
`path:folder:${pathIdentifier}`); | ||
} | ||
tree.setNode(`path:request:${pathIdentifier}:${method}`, { | ||
@@ -115,16 +154,3 @@ type: 'request', | ||
/** | ||
* If it is the last node, | ||
* it might happen that this exists as a folder. | ||
* | ||
* If yes add a request inside that folder else | ||
* add as a request on the previous path idendified which will be a folder. | ||
*/ | ||
if (tree.hasNode(`path:folder:${pathIdentifier}`)) { | ||
tree.setEdge(`path:folder:${pathIdentifier}`, `path:request:${pathIdentifier}:${method}`); | ||
} | ||
else { | ||
tree.setEdge(`path:folder:${previousPathIdentified}`, `path:request:${pathIdentifier}:${method}`); | ||
} | ||
tree.setEdge(`path:folder:${pathIdentifier}`, `path:request:${pathIdentifier}:${method}`); | ||
}); | ||
@@ -131,0 +157,0 @@ } |
{ | ||
"name": "openapi-to-postmanv2", | ||
"version": "4.9.0-beta.34", | ||
"version": "4.9.0-beta.35", | ||
"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
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
14220839
105291