|
34 | 34 | "TeiReranking",
|
35 | 35 | "Tgi",
|
36 | 36 | "TgiGaudi",
|
| 37 | + "TgiNvidia", |
37 | 38 | "Llm",
|
38 | 39 | "DocSum",
|
39 | 40 | "Router",
|
@@ -110,12 +111,16 @@ func (r *GMConnector) checkfields() field.ErrorList {
|
110 | 111 | return allErrs
|
111 | 112 | }
|
112 | 113 |
|
113 |
| -func checkStepName(s Step, fldRoot *field.Path, nodeName string) *field.Error { |
| 114 | +func checkStepName(s Step, idx int, fldRoot *field.Path, nodeName string) *field.Error { |
114 | 115 | if len(s.StepName) == 0 {
|
115 |
| - return field.Invalid(fldRoot.Child(nodeName).Child("stepName"), s, fmt.Sprintf("the step name for node %v cannot be empty", nodeName)) |
| 116 | + return field.Invalid(fldRoot.Child(nodeName).Child(fmt.Sprintf("steps[%d]", idx)).Child("name"), |
| 117 | + s, |
| 118 | + fmt.Sprintf("the step name for node %v cannot be empty", nodeName)) |
116 | 119 | }
|
117 | 120 | if !slices.Contains(stepNames, s.StepName) {
|
118 |
| - return field.Invalid(fldRoot.Child(nodeName).Child("stepName"), s, fmt.Sprintf("invalid step name: %s for node %v", s.StepName, nodeName)) |
| 121 | + return field.Invalid(fldRoot.Child(nodeName).Child(fmt.Sprintf("steps[%d]", idx)).Child("name"), |
| 122 | + s, |
| 123 | + fmt.Sprintf("invalid step name: %s for node %v", s.StepName, nodeName)) |
119 | 124 | }
|
120 | 125 | return nil
|
121 | 126 | }
|
@@ -143,20 +148,22 @@ func validateNames(nodes map[string]Router, fldPath *field.Path) field.ErrorList
|
143 | 148 | var errs field.ErrorList
|
144 | 149 |
|
145 | 150 | for name, router := range nodes {
|
146 |
| - for _, step := range router.Steps { |
| 151 | + for idx, step := range router.Steps { |
147 | 152 | // validate step name
|
148 |
| - if err := checkStepName(step, fldPath, name); err != nil { |
| 153 | + if err := checkStepName(step, idx, fldPath, name); err != nil { |
149 | 154 | errs = append(errs, err)
|
150 | 155 | }
|
151 | 156 |
|
152 | 157 | // check node name has been defined in the spec
|
153 | 158 | if !nodeNameExists(step.NodeName, nodeNames) {
|
154 |
| - errs = append(errs, field.Invalid(fldPath.Child(name).Child("nodeName"), step, fmt.Sprintf("node name: %v in step %v does not exist", step.NodeName, step.StepName))) |
| 159 | + errs = append(errs, field.Invalid(fldPath.Child(name).Child(fmt.Sprintf("steps[%d]", idx)).Child("nodeName"), |
| 160 | + step, |
| 161 | + fmt.Sprintf("node name: %v in step %v does not exist", step.NodeName, step.StepName))) |
155 | 162 | }
|
156 | 163 |
|
157 | 164 | // check service name uniqueness
|
158 | 165 | if len(step.InternalService.ServiceName) != 0 && slices.Contains(serviceNames, step.InternalService.ServiceName) {
|
159 |
| - errs = append(errs, field.Invalid(fldPath.Child(name).Child("internalService").Child("serviceName"), |
| 166 | + errs = append(errs, field.Invalid(fldPath.Child(name).Child(fmt.Sprintf("steps[%d]", idx)).Child("internalService").Child("serviceName"), |
160 | 167 | step,
|
161 | 168 | fmt.Sprintf("service name: %v in node %v already exists", step.InternalService.ServiceName, name)))
|
162 | 169 | } else {
|
|
0 commit comments