Validate reports whether the session-start request contains the task and run context required by the bridge.
()
| 1052 | |
| 1053 | // Validate reports whether the session-start request contains the task and run context required by the bridge. |
| 1054 | func (r *StartTaskSession) Validate() error { |
| 1055 | if r == nil { |
| 1056 | return fmt.Errorf("%w: start_task_session is required", ErrValidation) |
| 1057 | } |
| 1058 | if err := r.Task.Validate(); err != nil { |
| 1059 | return err |
| 1060 | } |
| 1061 | if err := r.Run.Validate(); err != nil { |
| 1062 | return err |
| 1063 | } |
| 1064 | if err := r.Actor.Validate(); err != nil { |
| 1065 | return err |
| 1066 | } |
| 1067 | if strings.TrimSpace(r.Run.TaskID) != strings.TrimSpace(r.Task.ID) { |
| 1068 | return fmt.Errorf("%w: start_task_session.run.task_id must match start_task_session.task.id", ErrValidation) |
| 1069 | } |
| 1070 | if r.ExecutionProfile != nil { |
| 1071 | if strings.TrimSpace(r.ExecutionProfile.TaskID) != strings.TrimSpace(r.Task.ID) { |
| 1072 | return fmt.Errorf( |
| 1073 | "%w: start_task_session.execution_profile.task_id must match start_task_session.task.id", |
| 1074 | ErrValidation, |
| 1075 | ) |
| 1076 | } |
| 1077 | if err := r.ExecutionProfile.Validate(DefaultExecutionProfileValidationOptions()); err != nil { |
| 1078 | return err |
| 1079 | } |
| 1080 | } |
| 1081 | return nil |
| 1082 | } |
| 1083 | |
| 1084 | // Validate reports whether the session reference returned by the bridge is usable. |
| 1085 | func (r SessionRef) Validate() error { |