MCPcopy Create free account
hub / github.com/Botloader/botloader / validate_option_name

Function validate_option_name

components/validation/src/runtime.rs:200–214  ·  view source on GitHub ↗
(ctx: &mut ValidationContext, name: &str)

Source from the content-addressed store, hash-verified

198}
199
200fn validate_option_name(ctx: &mut ValidationContext, name: &str) {
201 if name.chars().count() > 42 {
202 ctx.push_field_error("name", "name can be max 42 characters long".to_string());
203 }
204
205 lazy_static! {
206 static ref RE: Regex = Regex::new(r#"^[\w_-]*$"#).unwrap();
207 }
208 if !RE.is_match(name) {
209 ctx.push_field_error(
210 "name",
211 "name can only contain 'word characters', '-' and '_'".to_string(),
212 );
213 }
214}

Callers 1

validateMethod · 0.85

Calls 2

countMethod · 0.80
push_field_errorMethod · 0.80

Tested by

no test coverage detected