Skip to content

Commit

Permalink
disallow adding properties with reserved names (like id or labels)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhspetersson committed Dec 24, 2024
1 parent 706f40b commit aa35b79
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/property.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,10 @@ impl PropertyManager {
}

pub fn add_property(&mut self, name: String, value_type: String, color: String, style: Option<String>, enum_values: Option<Vec<String>>, cond_format: Option<Vec<String>>) -> Result<(), String> {
if name.to_lowercase() == "id" || name.to_lowercase() == "labels" {
return Err(format!("`{}` is a reserved property name", name));
}

let property = Property {
name,
value_type: value_type.parse()?,
Expand Down

0 comments on commit aa35b79

Please sign in to comment.