Validate the version input

Validate the version input
This commit is contained in:
Luis Tejeda
2022-06-15 17:01:33 -05:00
parent 7a7a8ab260
commit 2c0d63ff29
4 changed files with 84 additions and 3 deletions

View File

@@ -6,7 +6,7 @@
const { ParseError } = require('./common/ParseError.js');
const { formatDataPath, checkIsCorrectType, isKnownType } = require('./common/schemaUtilsCommon.js'),
{ getConcreteSchemaUtils, SWAGGER_VERSION } = require('./common/versionUtils.js'),
{ getConcreteSchemaUtils, SWAGGER_VERSION, validateSupportedVersion } = require('./common/versionUtils.js'),
async = require('async'),
sdk = require('postman-collection'),
schemaFaker = require('../assets/json-schema-faker.js'),
@@ -4986,6 +4986,9 @@ module.exports = {
if (processInput.data[0].path === '') {
throw new Error('"Path" of the data element should be provided');
}
if (processInput.specificationVersion && !validateSupportedVersion(processInput.specificationVersion)) {
throw new Error(`The provided version "${processInput.specificationVersion}" is not valid`);
}
},
MULTI_FILE_API_TYPE_ALLOWED_VALUE
};