lib/plugins/aws/invokeLocal/index.js/AwsInvokeLocal/extendedValidate
class AwsInvokeLocal:  extendedValidate() {
    return this.validate().then(() => {
      // validate function exists in service
      this.options.functionObj = this.serverless.service.getFunction(this.options.function);
      this.options.data = this.options.data || '';

      return new BbPromise(resolve => {
        if (this.options.contextPath) {
          this.validateFile(this.options.contextPath, 'context');
        }

        if (this.options.data) {
          return resolve();
        } else if (this.options.path) {
          this.validateFile(this.options.path, 'data');
          return resolve();
        }

        return stdin()
          .then(input => {
            this.options.data = input;
            return resolve();
          })
          .catch(() => resolve());
      }).then(() => {
        try {
          // unless asked to preserve raw input, attempt to parse any provided objects
          if (!this.options.raw) {
            if (this.options.data) {
              this.options.data = JSON.parse(this.options.data);
            }
            if (this.options.context) {
              this.options.context = JSON.parse(this.options.context);
            }
          }
        } catch (exception) {
          // do nothing if it's a simple string or object already
        }
      });
    });
  }