MCPcopy Create free account
hub / github.com/github/gh-aw / validateModelIdentifierStrings

Function validateModelIdentifierStrings

pkg/workflow/model_alias_validation.go:180–205  ·  view source on GitHub ↗

─── V-MAF-001, 002, 003, 006: identifier syntax & param validation ─────────── validateModelIdentifierStrings validates a slice of model identifier strings. Returns a slice of error messages (not wrapped errors) so the caller can decide how to report them.

(identifiers []string, context string)

Source from the content-addressed store, hash-verified

178// Returns a slice of error messages (not wrapped errors) so the caller can
179// decide how to report them.
180func validateModelIdentifierStrings(identifiers []string, context string) []string {
181 var errs []string
182 for _, id := range identifiers {
183 if id == "" {
184 errs = append(errs, context+": model identifier must not be empty")
185 continue
186 }
187 // Skip GitHub Actions expressions — they are resolved at runtime.
188 // This includes whole-string expressions ("${{ inputs.model }}") and
189 // partial expressions ("${{ inputs.model }}?effort=high", "copilot/${{ inputs.model }}").
190 if containsExpression(id) {
191 continue
192 }
193 p, err := ParseModelIdentifier(id)
194 if err != nil {
195 // V-MAF-001 / V-MAF-006
196 errs = append(errs, fmt.Sprintf("%s: %s", context, err.Error()))
197 continue
198 }
199 // V-MAF-002 and V-MAF-003: validate known parameter values.
200 if err := ValidateKnownParams(p.Params); err != nil {
201 errs = append(errs, fmt.Sprintf("%s: %s", context, err.Error()))
202 }
203 }
204 return errs
205}
206
207// ─── V-MAF-011: unknown parameter warning ─────────────────────────────────────
208

Calls 4

containsExpressionFunction · 0.85
ParseModelIdentifierFunction · 0.85
ValidateKnownParamsFunction · 0.85
ErrorMethod · 0.45