Skip to main content

validate_fragment_source

Function validate_fragment_source 

Source
fn validate_fragment_source(
    config_json: &str,
    source_string: &str,
) -> (Vec<String>, String)
Expand description

Validates a fragment source XPath expression and computes dependencies

Parses the source string to find all ./FRAGMENT[…] references, validates that referenced fragments exist, and returns their IDs.

§Arguments

  • config_json - Configuration JSON string
  • source_string - Fragment source XPath expression

§Returns

Returns (dependency_ids, error_message) tuple

  • dependency_ids: Vec of fragment IDs as strings (empty if no dependencies)
  • error_message: Empty string on success, error description on failure

§Example

use sz_configtool_lib::fragments;
let source = "./FRAGMENT[./SAME_NAME>0 and ./SAME_STAB>0]";
let config = r#"{"G2_CONFIG": {"CFG_ERFRAG": []}}"#;
// Note: validate_fragment_source is private, used internally by add_fragment