validateParamKey validates a parameter key per the ABNF grammar.
(key string)
| 325 | |
| 326 | // validateParamKey validates a parameter key per the ABNF grammar. |
| 327 | func 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. |
| 343 | func validateParamValue(value string) error { |
no test coverage detected