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

Function validateModelToken

pkg/workflow/model_identifier.go:251–262  ·  view source on GitHub ↗

validateModelToken validates a model token (no wildcards) per the ABNF grammar.

(token string)

Source from the content-addressed store, hash-verified

249
250// validateModelToken validates a model token (no wildcards) per the ABNF grammar.
251func validateModelToken(token string) error {
252 if token == "" {
253 return errors.New("model identifier: model token must not be empty (segment type: model)")
254 }
255 if !reModelToken.MatchString(token) {
256 if r := firstForbiddenCharInModelToken(token); r != 0 {
257 return fmt.Errorf("model identifier: character %q is not allowed in model token %q (segment type: model)", r, token)
258 }
259 return fmt.Errorf("model identifier: model token %q is syntactically invalid (segment type: model)", token)
260 }
261 return nil
262}
263
264// validateModelGlobToken validates a model-glob-token (may contain "*").
265func validateModelGlobToken(token string) error {

Callers 1

ParseModelIdentifierFunction · 0.85

Calls 2

ErrorfMethod · 0.45

Tested by

no test coverage detected