validateModelToken validates a model token (no wildcards) per the ABNF grammar.
(token string)
| 249 | |
| 250 | // validateModelToken validates a model token (no wildcards) per the ABNF grammar. |
| 251 | func 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 "*"). |
| 265 | func validateModelGlobToken(token string) error { |
no test coverage detected