mirror of
https://github.com/postmanlabs/openapi-to-postman.git
synced 2022-11-29 22:05:00 +03:00
Change defatult version
change the default version from 3.0.0 to 3.0 and validate incorrect input.type value (different than multiFile)
This commit is contained in:
@@ -92,7 +92,8 @@ const { formatDataPath, checkIsCorrectType, isKnownType } = require('./common/sc
|
||||
{ getRelatedFiles } = require('./relatedFiles'),
|
||||
{ compareVersion } = require('./common/versionUtils.js'),
|
||||
parse = require('./parse'),
|
||||
{ getBundleContentAndComponents } = require('./bundle.js');
|
||||
{ getBundleContentAndComponents } = require('./bundle.js'),
|
||||
MULTI_FILE_API_TYPE_ALLOWED_VALUE = 'multiFile';
|
||||
/* eslint-enable */
|
||||
|
||||
// See https://github.com/json-schema-faker/json-schema-faker/tree/master/docs#available-options
|
||||
@@ -4797,7 +4798,7 @@ module.exports = {
|
||||
*/
|
||||
mapGetRootFilesOutputToDetectRootFilesOutput(output, version) {
|
||||
if (!version) {
|
||||
version = '3.0.0';
|
||||
version = '3.0';
|
||||
}
|
||||
let adaptedData = output.map((file) => {
|
||||
return { path: file };
|
||||
@@ -4906,7 +4907,7 @@ module.exports = {
|
||||
* @returns {object} root files information and data input
|
||||
*/
|
||||
processRelatedFiles(inputRelatedFiles, toBundle = false) {
|
||||
let version = inputRelatedFiles.specificationVersion ? inputRelatedFiles.specificationVersion : '3.0.0',
|
||||
let version = inputRelatedFiles.specificationVersion ? inputRelatedFiles.specificationVersion : '3.0',
|
||||
res = {
|
||||
result: true,
|
||||
output: {
|
||||
@@ -4957,6 +4958,9 @@ module.exports = {
|
||||
if (!processInput.type) {
|
||||
throw new Error('"Type" parameter should be provided');
|
||||
}
|
||||
if (processInput.type !== MULTI_FILE_API_TYPE_ALLOWED_VALUE) {
|
||||
throw new Error('"Type" parameter value allowed is ' + MULTI_FILE_API_TYPE_ALLOWED_VALUE);
|
||||
}
|
||||
if (!processInput.data || processInput.data.length === 0) {
|
||||
throw new Error('"Data" parameter should be provided');
|
||||
}
|
||||
@@ -4971,6 +4975,6 @@ module.exports = {
|
||||
throw new ParseError(result.reason);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
},
|
||||
MULTI_FILE_API_TYPE_ALLOWED_VALUE
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user