code: func (cat *catalog) validateTriggerProto(ctx *validation.Context, t *messages.Trigger, jobIDs stringset.Set, failOnMissing bool) proto.Message {
  	if t.Id == "" {
  		ctx.Errorf("missing 'id' field'")
  	} else if !jobIDRe.MatchString(t.Id) {
  		ctx.Errorf("%q is not valid value for 'id' field", t.Id)
  	}
  	if t.Schedule != "" {
  		ctx.Enter("schedule")
  		if _, err := schedule.Parse(t.Schedule, 0); err != nil {
  			ctx.Errorf("%s is not valid value for 'schedule' field - %s", t.Schedule, err)
  		}
  		ctx.Exit()
  	}
  	filtered := make([]string, 0, len(t.Triggers))
  	for _, id := range t.Triggers {
  		switch {
  		case jobIDs.Has(id):
  			filtered = append(filtered, id)
  		case failOnMissing:
  			ctx.Errorf("referencing unknown job %q in 'triggers' field", id)
  		default:
  			logging.Warningf(ctx.Context,
  				"Trigger %q references unknown job %q in 'triggers' field", t.Id, id)
  		}
  	}
  	t.Triggers = filtered
  	cat.validateTriggeringPolicy(ctx, t.TriggeringPolicy)
  	return cat.validateTaskProto(ctx, t)
  }
docs: // validateTriggerProto validates and filters messages.Trigger protobuf message.
  //
  // It also extracts a task definition from it.
  //
  // Takes a set of all defined job IDs, to verify the trigger triggers only
  // declared jobs. If failOnMissing is true, referencing an undefined job is
  // reported as a validation error. Otherwise it is logged as a warning, and the
  // reference to the undefined job is removed.
  //
  // Errors are returned via validation.Context.