mirror of
https://github.com/postmanlabs/openapi-to-postman.git
synced 2022-11-29 22:05:00 +03:00
- Moving each bundling version rules to new files - Removing componentsParentMatcher files - Replacing the getKeyInComponents for each version by a generalized one - Adding a method to get the version bundling data by version - Replacing the new sources in files
34 lines
933 B
JavaScript
34 lines
933 B
JavaScript
module.exports = {
|
|
/**
|
|
* Resolve the scenario if the item is in second level
|
|
* @param {array} trace The keyInComponents
|
|
* @param {number} index the current index
|
|
* @return {undefined}
|
|
*/
|
|
|
|
resolveSecondLevelChild: function (trace, index, definitions) {
|
|
const item = definitions[trace[index + 2]];
|
|
if (item) {
|
|
trace[index + 1] = item;
|
|
}
|
|
},
|
|
|
|
/**
|
|
* If the provided item is included in any defined container it returns the container name
|
|
* else it return the same item
|
|
* @param {string} item The current item in the iteration
|
|
* @returns {string} the name of container where item is included or the item if it's not included
|
|
* in any container
|
|
*/
|
|
|
|
resolveFirstLevelChild: function(item, containers) {
|
|
for (let [key, containerItems] of Object.entries(containers)) {
|
|
if (containerItems.includes(item)) {
|
|
return key;
|
|
}
|
|
}
|
|
|
|
return item;
|
|
}
|
|
};
|