sarif_rust 0.3.0

A comprehensive Rust library for parsing, generating, and manipulating SARIF (Static Analysis Results Interchange Format) v2.1.0 files
Documentation
use sarif_rust::*;

fn main() -> std::result::Result<(), Box<dyn std::error::Error>> {
    println!("SARIF Rust Library - Testing JSON Serialization");

    // Test 1: Create minimal SARIF log
    let sarif = SarifLog::v2_1_0();
    let json = to_string_pretty(&sarif)?;
    println!("Minimal SARIF JSON:");
    println!("{}", json);
    println!();

    // Test 2: Create SARIF with a run and result
    let tool_driver = ToolComponent::new("test-analyzer").with_version("1.0.0");
    let tool = Tool {
        driver: tool_driver,
        extensions: None,
        properties: None,
    };

    let result = sarif_rust::types::Result::new("Test finding")
        .with_rule_id("TEST001")
        .with_level(Level::Warning)
        .add_location(Location::with_physical_location(
            PhysicalLocation::with_artifact_location(ArtifactLocation::new("src/test.rs"))
                .with_region(Region::from_coordinates(10, 5, 10, 15)),
        ));

    let run = Run::new(tool).add_result(result);

    let sarif_with_data = SarifLog::v2_1_0().add_run(run);

    let json_with_data = to_string_pretty(&sarif_with_data)?;
    println!("SARIF with data:");
    println!("{}", json_with_data);
    println!();

    // Test 3: Parse back the JSON
    let parsed_sarif = from_str(&json_with_data)?;
    println!("Successfully parsed SARIF back from JSON");
    println!("Original runs count: {}", sarif_with_data.runs.len());
    println!("Parsed runs count: {}", parsed_sarif.runs.len());

    // Test 4: Validate the parsed SARIF
    match parsed_sarif.validate() {
        Ok(()) => println!("✅ SARIF validation passed"),
        Err(e) => println!("❌ SARIF validation failed: {}", e),
    }

    println!("\n✅ Basic JSON serialization tests completed successfully!");
    Ok(())
}