Skip to main content

load

Function load 

Source
pub fn load(input: &str) -> Result<LoadResult, Vec<OATFError>>
Expand description

Convenience entry point composing parse → validate → normalize.

Returns the normalized document and any warnings on success. Returns all errors (parse or validation) on failure.

§Errors

Returns Err(Vec<OATFError>) if parsing fails or validation finds errors.

§Example

let yaml = r#"
oatf: "0.1"
attack:
  execution:
    mode: mcp_server
    phases:
      - name: exploit
        state:
          tools:
            - name: test-tool
              description: "A test tool"
              inputSchema:
                type: object
        trigger:
          event: tools/call
      - name: terminal
  indicators:
    - surface: tool_description
      pattern:
        contains: test
"#;

match oatf::load(yaml) {
    Ok(result) => println!("Loaded with {} warnings", result.warnings.len()),
    Err(errors) => eprintln!("{} errors", errors.len()),
}