diff --git a/proxmox-api-macro/src/util.rs b/proxmox-api-macro/src/util.rs index 6ac39c2d..97481313 100644 --- a/proxmox-api-macro/src/util.rs +++ b/proxmox-api-macro/src/util.rs @@ -29,7 +29,11 @@ pub struct FieldName { impl FieldName { pub fn new(name: String, span: Span) -> Self { - let ident_str = name.replace("-", "_"); + let mut ident_str = name.replace(['-', '.', '+'].as_ref(), "_"); + + if ident_str.chars().next().unwrap().is_numeric() { + ident_str.insert(0, '_'); + } Self { ident: Ident::new(&ident_str, span),