Skip to main content

add_attribute

Function add_attribute 

Source
pub fn add_attribute(
    config_json: &str,
    params: AddAttributeParams<'_>,
) -> Result<(String, Value)>
Expand description

Add a new attribute to the configuration

§Arguments

  • config_json - JSON configuration string
  • params - Attribute parameters (attribute, feature, element, class required; others optional)

§Returns

Tuple of (modified_json, new_attribute_value) - returns both the modified config and the newly created attribute for display purposes

§Errors

  • AlreadyExists if attribute code already exists
  • InvalidInput if attribute class is invalid
  • JsonParse if config_json is invalid
  • MissingSection if required sections don’t exist