lib/classes/Service.js/Service/load
class Service:  load(rawOptions) {
    const that = this;
    const options = rawOptions || {};
    options.stage = options.stage || options.s;
    options.region = options.region || options.r;
    const servicePath = this.serverless.config.servicePath;

    // skip if the service path is not found
    // because the user might be creating a new service
    if (!servicePath) {
      return BbPromise.resolve();
    }

    // List of supported service filename variants.
    // The order defines the precedence.
    const serviceFilenames = [
      'serverless.yaml',
      'serverless.yml',
      'serverless.json',
    ];

    const serviceFilePaths = _.map(serviceFilenames, filename => path.join(servicePath, filename));
    const serviceFileIndex = _.findIndex(serviceFilePaths,
      filename => this.serverless.utils.fileExistsSync(filename)
    );

    // Set the filename if found, otherwise set the preferred variant.
    const serviceFilePath = serviceFileIndex !== -1 ?
      serviceFilePaths[serviceFileIndex] :
      _.first(serviceFilePaths);
    const serviceFilename = serviceFileIndex !== -1 ?
      serviceFilenames[serviceFileIndex] :
      _.first(serviceFilenames);

    return that.serverless.yamlParser
      .parse(serviceFilePath)
      .then((serverlessFileParam) => {
        const serverlessFile = serverlessFileParam;
        // basic service level validation
        const version = this.serverless.utils.getVersion();
        const ymlVersion = serverlessFile.frameworkVersion;
        if (ymlVersion && !semver.satisfies(version, ymlVersion)) {
          const errorMessage = [
            `The Serverless version (${version}) does not satisfy the`,
            ` "frameworkVersion" (${ymlVersion}) in ${serviceFilename}`,
          ].join('');
          throw new ServerlessError(errorMessage);
        }
        if (!serverlessFile.service) {
          throw new ServerlessError(`"service" property is missing in ${serviceFilename}`);
        }
        if (_.isObject(serverlessFile.service) && !serverlessFile.service.name) {
          throw new ServerlessError(`"service" is missing the "name" property in ${serviceFilename}`);   // eslint-disable-line max-len
        }
        if (!serverlessFile.provider) {
          throw new ServerlessError(`"provider" property is missing in ${serviceFilename}`);
        }

        if (typeof serverlessFile.provider !== 'object') {
          const providerName = serverlessFile.provider;
          serverlessFile.provider = {
            name: providerName,
          };
        }

        const providers = ['aws', 'azure', 'google', 'openwhisk'];
        if (providers.indexOf(serverlessFile.provider.name) === -1) {
          const errorMessage = [
            `Provider "${serverlessFile.provider.name}" is not supported.`,
            ` Valid values for provider are: ${providers.join(', ')}.`,
            ` Please provide one of those values to the "provider" property in ${serviceFilename}`,
          ].join('');
          throw new ServerlessError(errorMessage);
        }

        if (_.isObject(serverlessFile.service)) {
          that.serviceObject = serverlessFile.service;
          that.service = serverlessFile.service.name;
        } else {
          that.serviceObject = { name: serverlessFile.service };
          that.service = serverlessFile.service;
        }

        that.custom = serverlessFile.custom;
        that.plugins = serverlessFile.plugins;
        that.resources = serverlessFile.resources;
        that.functions = serverlessFile.functions || {};

        // merge so that the default settings are still in place and
        // won't be overwritten
        that.provider = _.merge(that.provider, serverlessFile.provider);

        if (serverlessFile.package) {
          that.package.individually = serverlessFile.package.individually;
          that.package.path = serverlessFile.package.path;
          that.package.artifact = serverlessFile.package.artifact;
          that.package.exclude = serverlessFile.package.exclude;
          that.package.include = serverlessFile.package.include;
          that.package.excludeDevDependencies = serverlessFile.package.excludeDevDependencies;
        }

        return this;
      });
  }