function getSpecVersion({ type, data, specificationVersion }) {
  if (!data) {
    return DEFAULT_SPEC_VERSION;
  }
  if (['multiFile'].includes(type)) {
    if (!specificationVersion) {
      return DEFAULT_SPEC_VERSION;
    }
    return getVersionByStringInput(specificationVersion);
  }

  if (['folder'].includes(type)) {
    data = getFileWithVersion(data, specificationVersion);
  }
  else if (['file'].includes(type)) {
    try {
      data = fs.readFileSync(data, 'utf8');
    }
    catch (error) {
      return DEFAULT_SPEC_VERSION; // If path is invalid it will follow the OAS 3.0 way
    }
  }

  if (type === 'json') {
    data = JSON.stringify(data);
  }
  const openapi30 = getVersionRegexp(VERSION_30),
    openapi31 = getVersionRegexp(VERSION_31),
    openapi20 = getVersionRegexp(VERSION_20),
    is30 = typeof data === 'string' && data.match(openapi30),
    is31 = typeof data === 'string' && data.match(openapi31),
    is20 = typeof data === 'string' && data.match(openapi20);

  let version = DEFAULT_SPEC_VERSION;

  if (is30) {
    version = VERSION_30.version;
  }
  else if (is31) {
    version = VERSION_31.version;
  }
  else if (is20) {
    version = VERSION_20.version;
  }
  return version;
}
Return the version of the provided specification
@param {string} spec Data from input file
@returns {string} version of specification