pub fn generate_sample_with_config<T>(
message_type: &str,
scenario_name: Option<&str>,
config: &ScenarioConfig,
) -> Result<SwiftMessage<T>>where
T: SwiftMessageBody + DeserializeOwned,
Expand description
Generate a sample SWIFT MT message based on test scenarios with custom configuration
This function loads a test scenario configuration for the specified message type and generates a realistic SWIFT message using datafake-rs for dynamic data generation.
§Arguments
message_type
- The MT message type (e.g., “MT103”, “MT202”)scenario_name
- Optional scenario name. If None, uses the default scenarioconfig
- Configuration for scenario file paths
§Returns
Returns a complete SwiftMessage object with headers and the message body
§Example
// Generate with custom paths
let config = ScenarioConfig::with_paths(vec![PathBuf::from("./my_scenarios")]);
let mt103_msg: SwiftMessage<MT103> = generate_sample_with_config("MT103", None, &config).unwrap();
println!("{}", mt103_msg.to_mt_message());