mirror of
https://github.com/postmanlabs/openapi-to-postman.git
synced 2022-11-29 22:05:00 +03:00
Added test for 31x
Added test for 31x
This commit is contained in:
committed by
Erik Mendoza
parent
0be5fb9a75
commit
d6fa8832eb
@@ -21,12 +21,29 @@ const COLLECTION_NAME = 'Imported from OpenAPI 3.0',
|
||||
|
||||
// This provides the base class for
|
||||
// errors with the input OpenAPI spec
|
||||
OpenApiErr = require('./error.js');
|
||||
OpenApiErr = require('./error.js'),
|
||||
DEFAULT_SPEC_VERSION = '3.0';
|
||||
|
||||
let path = require('path'),
|
||||
schemaUtils,
|
||||
pathBrowserify = require('path-browserify');
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} specVersion - the OAS specification version
|
||||
* @returns {NodeRequire} the schema utils according to version
|
||||
*/
|
||||
function getConcreteSchemaUtils(specVersion) {
|
||||
let schemaUtils = {};
|
||||
if (specVersion === DEFAULT_SPEC_VERSION) {
|
||||
schemaUtils = require('./schemaUtils');
|
||||
}
|
||||
else {
|
||||
schemaUtils = require('./schemaUtils31X');
|
||||
}
|
||||
return schemaUtils;
|
||||
}
|
||||
|
||||
class SchemaPack {
|
||||
constructor (input, options = {}) {
|
||||
this.input = input;
|
||||
@@ -49,14 +66,7 @@ class SchemaPack {
|
||||
let indentCharacter = this.computedOptions.indentCharacter,
|
||||
specVersion = '3.0';// Get real version
|
||||
this.computedOptions.indentCharacter = indentCharacter === 'tab' ? '\t' : ' ';
|
||||
|
||||
if (specVersion === '3.0') {
|
||||
schemaUtils = require('./schemaUtils');
|
||||
}
|
||||
else {
|
||||
schemaUtils = require('./schemaUtils31X');
|
||||
}
|
||||
|
||||
schemaUtils = getConcreteSchemaUtils(specVersion);
|
||||
this.validate();
|
||||
}
|
||||
|
||||
@@ -194,7 +204,7 @@ class SchemaPack {
|
||||
}
|
||||
|
||||
try {
|
||||
rootFiles = parse.getRootFiles(input, files);
|
||||
rootFiles = parse.getRootFiles(input, schemaUtils.inputValidation, files);
|
||||
}
|
||||
catch (e) {
|
||||
return cb(null, {
|
||||
|
||||
Reference in New Issue
Block a user