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

Function validateModelGlobToken

pkg/workflow/model_identifier.go:265–280  ·  view source on GitHub ↗

validateModelGlobToken validates a model-glob-token (may contain "*").

(token string)

Source from the content-addressed store, hash-verified

263
264// validateModelGlobToken validates a model-glob-token (may contain "*").
265func validateModelGlobToken(token string) error {
266 if token == "" {
267 return errors.New("model identifier: model glob token must not be empty (segment type: model)")
268 }
269 for _, r := range token {
270 switch {
271 case r >= 'A' && r <= 'Z', r >= 'a' && r <= 'z', r >= '0' && r <= '9':
272 // ALPHA / DIGIT — always allowed
273 case r == '-', r == '_', r == '.', r == '*':
274 // allowed in glob tokens
275 default:
276 return fmt.Errorf("model identifier: character %q is not allowed in glob model token %q (segment type: model)", r, token)
277 }
278 }
279 return nil
280}
281
282// validateBareName validates a bare identifier name per the ABNF grammar.
283func validateBareName(name string) error {

Callers 1

ParseModelIdentifierFunction · 0.85

Calls 1

ErrorfMethod · 0.45

Tested by

no test coverage detected