mirror of
https://github.com/postmanlabs/openapi-to-postman.git
synced 2022-11-29 22:05:00 +03:00
add multiple versions support
add multiple versions support
This commit is contained in:
committed by
Erik Mendoza
parent
36e83721dd
commit
30cc74b720
15
lib/parse.js
15
lib/parse.js
@@ -5,7 +5,8 @@ var yaml = require('js-yaml'),
|
||||
path = require('path'),
|
||||
pathBrowserify = require('path-browserify'),
|
||||
resolver = require('oas-resolver-browser'),
|
||||
yamlParse = require('yaml');
|
||||
yamlParse = require('yaml'),
|
||||
{ compareVersion } = require('./common/versionUtils.js');
|
||||
const BROWSER = 'browser';
|
||||
|
||||
module.exports = {
|
||||
@@ -79,9 +80,10 @@ module.exports = {
|
||||
* @param {Object} inputValidation Validator according to version
|
||||
* @param {Object} options computed process options
|
||||
* @param {Object} files Files map
|
||||
* @param {string} specificationVersion the string of the desired version
|
||||
* @return {String} rootFile
|
||||
*/
|
||||
getRootFiles: function (input, inputValidation, options, files = {}) {
|
||||
getRootFiles: function (input, inputValidation, options, files = {}, specificationVersion) {
|
||||
let rootFilesArray = [],
|
||||
filesPathArray = input.data,
|
||||
origin = input.origin || '';
|
||||
@@ -110,7 +112,14 @@ module.exports = {
|
||||
throw new Error(obj.reason);
|
||||
}
|
||||
if (inputValidation.validateSpec(oasObject, options).result) {
|
||||
rootFilesArray.push(filePath.fileName);
|
||||
if (specificationVersion) {
|
||||
if (compareVersion(specificationVersion, oasObject.openapi)) {
|
||||
rootFilesArray.push(filePath.fileName);
|
||||
}
|
||||
}
|
||||
else {
|
||||
rootFilesArray.push(filePath.fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user