Index: common/api/dm/service/v1/ensure_graph_data_normalize.go |
diff --git a/common/api/dm/service/v1/ensure_graph_data_normalize.go b/common/api/dm/service/v1/ensure_graph_data_normalize.go |
index b6f21f70ee8fd43157eeabd858415f1d5becdd55..def39cd14d20265de1931d8e104a7626e595faca 100644 |
--- a/common/api/dm/service/v1/ensure_graph_data_normalize.go |
+++ b/common/api/dm/service/v1/ensure_graph_data_normalize.go |
@@ -20,15 +20,23 @@ func (t *TemplateInstantiation) Normalize() error { |
// Normalize returns an error iff the request is invalid. |
func (r *EnsureGraphDataReq) Normalize() error { |
+ if r.ForExecution != nil { |
+ if err := r.ForExecution.Normalize(); err != nil { |
+ return err |
+ } |
+ } |
+ |
if err := r.Attempts.Normalize(); err != nil { |
return err |
} |
hasAttempts := false |
- for _, nums := range r.Attempts.To { |
- hasAttempts = true |
- if len(nums.Nums) == 0 { |
- return errors.New("EnsureGraphDataReq.attempts must only include valid (non-0, non-empty) attempt numbers") |
+ if r.Attempts != nil { |
+ for _, nums := range r.Attempts.To { |
+ hasAttempts = true |
+ if len(nums.Nums) == 0 { |
+ return errors.New("EnsureGraphDataReq.attempts must only include valid (non-0, non-empty) attempt numbers") |
+ } |
} |
} |
@@ -50,6 +58,12 @@ func (r *EnsureGraphDataReq) Normalize() error { |
} |
} |
+ for i, desc := range r.Quest { |
+ if err := desc.Normalize(); err != nil { |
+ return fmt.Errorf("quest[%d]: %s", i, err) |
+ } |
+ } |
+ |
if len(r.Quest) == 0 && !hasAttempts { |
return errors.New("EnsureGraphDataReq must have at least one of quests and attempts") |
} |