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

Function validateParamKey

pkg/workflow/model_identifier.go:327–340  ·  view source on GitHub ↗

validateParamKey validates a parameter key per the ABNF grammar.

(key string)

Source from the content-addressed store, hash-verified

325
326// validateParamKey validates a parameter key per the ABNF grammar.
327func validateParamKey(key string) error {
328 if key == "" {
329 return errors.New("model identifier: parameter key must not be empty (segment type: parameter key)")
330 }
331 if !reParamKey.MatchString(key) {
332 if r := firstForbiddenCharInProviderOrParam(key); r != 0 {
333 return fmt.Errorf("model identifier: character %q is not allowed in parameter key %q (segment type: parameter key)", r, key)
334 }
335 if !isAlpha(rune(key[0])) {
336 return fmt.Errorf("model identifier: parameter key %q must start with a letter (segment type: parameter key)", key)
337 }
338 }
339 return nil
340}
341
342// validateParamValue validates a parameter value per the ABNF grammar.
343func validateParamValue(value string) error {

Callers 1

parseQueryStringFunction · 0.85

Calls 3

isAlphaFunction · 0.85
ErrorfMethod · 0.45

Tested by

no test coverage detected