Creates a new Swagger specification object.

@param {string} version - The Swagger version

@constructor
192322
function (version) {
  var that = this;
  var createValidators = function (spec, validatorsMap) {
    return _.reduce(validatorsMap, function (result, schemas, schemaName) {
      result[schemaName] = helpers.createJsonValidator(schemas);

      return result;
    }, {});
  };
  var fixSchemaId = function (schemaName) {
    // Swagger 1.2 schema files use one id but use a different id when referencing schema files.  We also use the schema
    // file name to reference the schema in ZSchema.  To fix this so that the JSON Schema validator works properly, we
    // need to set the id to be the name of the schema file.
    var fixed = _.cloneDeep(that.schemas[schemaName]);

    fixed.id = schemaName;

    return fixed;
  };
  var primitives = ['string', 'number', 'boolean', 'integer', 'array'];

  switch (version) {
  case '1.2':
    this.docsUrl = 'https://github.com/swagger-api/swagger-spec/blob/master/versions/1.2.md';
    this.primitives = _.union(primitives, ['void', 'File']);
    this.schemasUrl = 'https://github.com/swagger-api/swagger-spec/tree/master/schemas/v1.2';

    // Here explicitly to allow browserify to work
    this.schemas = {
      'apiDeclaration.json': require('../schemas/1.2/apiDeclaration.json'),
      'authorizationObject.json': require('../schemas/1.2/authorizationObject.json'),
      'dataType.json': require('../schemas/1.2/dataType.json'),
      'dataTypeBase.json': require('../schemas/1.2/dataTypeBase.json'),
      'infoObject.json': require('../schemas/1.2/infoObject.json'),
      'modelsObject.json': require('../schemas/1.2/modelsObject.json'),
      'oauth2GrantType.json': require('../schemas/1.2/oauth2GrantType.json'),
      'operationObject.json': require('../schemas/1.2/operationObject.json'),
      'parameterObject.json': require('../schemas/1.2/parameterObject.json'),
      'resourceListing.json': require('../schemas/1.2/resourceListing.json'),
      'resourceObject.json': require('../schemas/1.2/resourceObject.json')
    };

    this.validators = createValidators(this, {
      'apiDeclaration.json': _.map([
        'dataTypeBase.json',
        'modelsObject.json',
        'oauth2GrantType.json',
        'authorizationObject.json',
        'parameterObject.json',
        'operationObject.json',
        'apiDeclaration.json'
      ], fixSchemaId),
      'resourceListing.json': _.map([
        'resourceObject.json',
        'infoObject.json',
        'oauth2GrantType.json',
        'authorizationObject.json',
        'resourceListing.json'
      ], fixSchemaId)
    });

    break;

  case '2.0':
    this.docsUrl = 'https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md';
    this.primitives = _.union(primitives, ['file']);
    this.schemasUrl = 'https://github.com/swagger-api/swagger-spec/tree/master/schemas/v2.0';

    // Here explicitly to allow browserify to work
    this.schemas = {
      'schema.json': require('../schemas/2.0/schema.json')
    };

    this.validators = createValidators(this, {
      'schema.json': [fixSchemaId('schema.json')]
    });

    break;

  default:
    throw new Error(version + ' is an unsupported Swagger specification version');
  }

  this.version = version;
}
1082222
function(apiName, swaggerPath) {
        return new Promise(function(resolve, reject) {
            fs.readFile(swaggerPath, function(err, data) {
                if (err) return reject(err);
                
                resolve(APIG.importRestApi({
                    body: data,
                    failOnWarnings: false
                }).promise());
            });
        });
    }
628244
public static Version parseMavenVersion(String version) {
		if (Strings.isNullOrEmpty(version)) {
			return new Version(0, 0, 0);
		}

		// Detect the snapshot
		final boolean isSnapshot;
		final String coreVersion;
		Matcher matcher = Artifact.VERSION_FILE_PATTERN.matcher(version);
		if (matcher.matches()) {
			coreVersion = matcher.group(1);
			isSnapshot = true;
		} else {
			matcher = SNAPSHOT_VERSION_PATTERN.matcher(version);
			if (matcher.matches()) {
				coreVersion = matcher.group(1);
				isSnapshot = true;
			} else {
				coreVersion = version;
				isSnapshot = false;
			}
		}

		// Parse the numbers
		final String[] parts = coreVersion.split("[.]"); //$NON-NLS-1$
		final int[] numbers = new int[] {0, 0, 0};
		int i = 0;
		while (i < numbers.length && i < parts.length) {
			try {
				numbers[i] = Integer.parseInt(parts[i]);
				++i;
			} catch (Exception exception) {
				// Force the exit of the loop since a number cannot be find.
				i = numbers.length;
			}
		}
		// Reply
		if (isSnapshot) {
			return new Version(numbers[0], numbers[1], numbers[2], SNAPSHOT_QUALIFIER);
		}
		return new Version(numbers[0], numbers[1], numbers[2]);
	}
1175303
function parseSwagger(swagger) {
  const { paths, components, info, servers, security } = swagger;
  const api = {};

  for (const path in paths) {
    for (const method in paths[path]) {
      const {
        operationId,
        summary,
        tags,
        parameters,
        requestBody,
        responses,
        security,
      } = paths[path][method];

      // make sure some props must exist
      if (!operationId)
        throw new Error(`missing operationId for ${method} ${path}`);
      if (!tags && !tags[0])
        throw new Error(`missing operation tag for ${method} ${path}`);

      // camelcase operationId
      const name = camelCase(operationId);

      // use 200/204 response, use http-errors as error responses. https://github.com/jshttp/http-errors
      const res200 = responses["200"] || responses[200];
      const res201 = responses["201"] || responses[201];
      const res202 = responses["202"] || responses[202];
      const res204 = responses["204"] || responses[204];
      const response = res200 || res201 || res202 || res204;
      if (!response)
        throw new Error(`missing 20X response for ${method} ${path}`);

      if (res200) {
        response.status = 200;
        response.content = get(response, ["content", "application/json"]);
      }

      if (res201) {
        response.status = 201;
        response.content = get(response, ["content", "application/json"]);
      }

      if (res202) {
        response.status = 202;
        response.content = get(response, ["content", "application/json"]);
      }

      if (res204) {
        response.status = 204;
        response.content = get(response, ["content", "application/json"]);
      }

      // requestBody
      if (requestBody) {
        requestBody.content = get(requestBody, ["content", "application/json"]);
      }

      // use tags[0] as api's name
      api[tags[0]] = api[tags[0]] || { name: tags[0], operations: [], ref: [] };

      api[tags[0]].operations.push({
        method,
        name,
        operationId,
        parameters,
        path,
        requestBody,
        response,
        summary,
        security,
      });
    }
  }

  return { info, servers, api, components, security };
}
621361
function loadSpecification(defPath, data) {
  const resolvedPath = path.resolve(defPath);

  const extName = path.extname(resolvedPath);
  const loader = LOADERS[extName];

  // Check whether the definition file is actually a usable file
  if (loader === undefined) {
    throw new Error('Definition file should be .js, .json, .yml or .yaml');
  }

  const swaggerDefinition = loader(data, resolvedPath);
  return swaggerDefinition;
}
568116
def swagger_object(target_class, request, options)
      object = {
        info: info_object(options[:info].merge(version: options[:doc_version])),
        swagger: '2.0',
        produces: content_types_for(target_class),
        authorizations: options[:authorizations],
        securityDefinitions: options[:security_definitions],
        security: options[:security],
        host: GrapeSwagger::DocMethods::OptionalObject.build(:host, options, request),
        basePath: GrapeSwagger::DocMethods::OptionalObject.build(:base_path, options, request),
        schemes: options[:schemes].is_a?(String) ? [options[:schemes]] : options[:schemes]
      }

      GrapeSwagger::DocMethods::Extensions.add_extensions_to_root(options, object)
      object.delete_if { |_, value| value.blank? }
    end
340821
function version() {
  const packageJson = require(path.resolve(__dirname, '..', 'package.json'));
  logger.info('@blackbaud/skyux-builder: %s', packageJson.version);
}
661715
function SwaggerServer(app) {
  app = app || express();

  // Event Emitter
  _.extend(this, EventEmitter.prototype);
  EventEmitter.call(this);

  /**
   * @type {Middleware}
   * @protected
   */
  this.__middleware = new SwaggerMiddleware(app);

  /**
   * @type {SwaggerParser}
   * @protected
   */
  this.__parser = new SwaggerParser(this);

  /**
   *
   * @type {Handlers|exports|module.exports}
   * @private
   */
  this.__handlers = new Handlers(this);

  /**
   * @type {SwaggerWatcher}
   * @protected
   */
  this.__watcher = new SwaggerWatcher(this);

  /**
   * The Express Application.
   * @type {e.application}
   */
  this.app = app;

  /**
   * The {@link DataStore} object that's used by the mock middleware.
   * See https://github.com/BigstickCarpet/swagger-express-middleware/blob/master/docs/exports/DataStore.md
   *
   * @type {DataStore}
   */
  Object.defineProperty(this, 'dataStore', {
    configurable: true,
    enumerable: true,
    get: function() {
      return app.get('mock data store');
    },
    set: function(value) {
      app.set('mock data store', value);
    }
  });

  /**
   * Parses the given Swagger API.
   *
   * @param {string|object} swagger
   * The file path or URL of a Swagger 2.0 API spec, in YAML or JSON format.
   * Or a valid Swagger API object (see https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#swagger-object).
   *
   * @param {function} [callback]
   * function(err, api, parser)
   */
  this.parse = function(swagger, callback) {
    this.__parser.parse(swagger);

    if (_.isFunction(callback)) {
      this.__parser.whenParsed(callback);
    }
  };

  /**
   * Adds the Swaggerize Express handlers to the Express Instance
   * (see https://github.com/krakenjs/swaggerize-express for info and acceptable formats)
   */
  this.addHandlers = function() {
    this.__handlers.setupHandlers();
  };

  // Patch the Express app to support Swagger
  application.patch(this);

  // For convenience, expose many of the Express app's methods directly on the Swagger Server object
  var server = this;
  swaggerMethods.concat(['enable', 'disable', 'set', 'listen', 'use', 'route', 'all'])
    .forEach(function(method) {
      server[method] = app[method].bind(app);
    });
}
543774
def create_version(self, service_id, inherit_service_id=None, comment=None):
		""""""
		body = self._formdata({
			"service_id": service_id,
			"inherit_service_id": inherit_service_id,
			"comment": comment,
		}, FastlyVersion.FIELDS)
		content = self._fetch("/service/%s/version" % service_id, method="POST", body=body)
		return FastlyVersion(self, content)
380165
def from_version(self, version, require_https=False):
        
        if version is None or self.version() == version:
            return self
        else:
            return Hive.from_url(self.get_version_url(version), require_https=require_https)
1043463
public static IModel newModel(String groupId, String artifactId, String version, String service, MuleVersionEnum muleVersion, TransportEnum inboundTransport, TransportEnum outboundTransport, TransformerEnum transformerType) {
		return doCreateNewModel(groupId, artifactId, version, service, muleVersion, null, null, inboundTransport, outboundTransport, transformerType, null, null);
	}
1062677
function generateVersionsTooltip(versions) {
    return versions.map(function(lib) {
      return lib.name + " " + lib.version;
    }).join("\n");
  }
1114074
function packageVersion(repo) {
    var location = repo ? path.join(repo, 'package.json') : './package.json';
    var pack = require(location);
    return pack['version'];
}
1304683
def create_tag(version: Union[Version, str], tag_format: Optional[str] = None):
    
    if isinstance(version, str):
        version = Version(version)

    if not tag_format:
        return version.public

    major, minor, patch = version.release
    prerelease = ""
    if version.is_prerelease:
        prerelease = f"{version.pre[0]}{version.pre[1]}"

    t = Template(tag_format)
    return t.safe_substitute(
        version=version, major=major, minor=minor, patch=patch, prerelease=prerelease
    )
804037
public MessageProtocol withVersion(String version) {
        return new MessageProtocol(contentType, charset, Optional.ofNullable(version));
    }
1079662
function saveNewVersion(version, versionFile) {
    fs.writeFileSync(versionFile, JSON.stringify({
        version
    }, null, 2), 'UTF-8');
}
884415
function Framework(spec, options) {
  if (!(this instanceof Framework)) {
    return new Framework(spec, options);
  }

  debug('create framework', spec, options);

  spec = lodash.cloneDeep(spec || {});
  options = lodash.cloneDeep(options || {});

  spec = lodash.defaults(spec, {
    swaggerVersion: '1.2',
    apis: [],
  });

  options = lodash.defaults(options,
    lodash.pick(spec, 'basePath')
  );
  delete spec.basePath;

  schema.validateThrow('ResourceListing', spec);
  schema.validateThrow(frameworkOptions, options);

  if (spec.swaggerVersion !== '1.2') {
    throw new Error('swaggerVersion not supported: ' + spec.swaggerVersion);
  }

  this.spec = spec;
  this.options = options;
  this.docs = new Docs(this);
  this.router = new Router(this);

  this.apis = {};
  this.middleware = {};
}