openjd-model 0.2.1

Open Job Description model library — parsing, validation, and job creation
Documentation

openjd-model

crates.io docs.rs license

Open Job Description (OpenJD) model library for Rust — parsing, validation, and job creation for OpenJD templates. Part of the openjd-rs workspace.

What this crate provides

  • Template parsing from YAML or JSON (via serde + serde-saphyr) into strongly typed 2023-09 model structures.
  • Validation — structural and cross-field constraint checks with Pydantic-compatible error paths (steps[0] -> script -> actions -> onRun) so messages match the Python reference implementation.
  • Job creation — instantiating jobs from templates: parameter resolution, format-string evaluation, parameter-space iteration, step dependency graphs.
  • Host capability matching — matching host requirements against runtime capabilities.
  • Extensions — the EXPR, FEATURE_BUNDLE_1, TASK_CHUNKING, and REDACTED_ENV_VARS extensions from the 2023-09 specification.

The crate passes 100% of the upstream OpenJD conformance test suite — over 700 template validation and environment-template tests on Linux, macOS, and Windows.

Minimum supported Rust version

Rust 1.92. Enforced in CI.

Quick example

use openjd_model::{parse, CallerLimits, DocumentType};

let yaml = r#"
specificationVersion: jobtemplate-2023-09
name: DemoJob
steps:
  - name: DemoStep
    script:
      actions:
        onRun:
          command: python
          args: ["-c", "print('Hello')"]
"#;

// Parse YAML into an intermediate `serde_json::Value`, then validate into
// a strongly typed `JobTemplate`. On failure you get human-friendly error
// paths; on success, a fully-typed template.
let caller_limits = CallerLimits::default();
let value = parse::document_string_to_object(yaml, DocumentType::Yaml, &caller_limits)?;
let template = parse::decode_job_template(value, None, &caller_limits)?;

assert_eq!(template.name.raw(), "DemoJob");
# Ok::<(), openjd_model::ModelError>(())

See the crate documentation on docs.rs for the full API, including create_job, StepParameterSpaceIterator, and StepDependencyGraph.

Relationship to openjd-expr

openjd-model depends on openjd-expr for expression parsing, format-string resolution, and symbol tables. FormatString and SymbolTable are re-exported at the crate root for convenience.

Versioning

This crate follows Semantic Versioning. While the major version is 0.x, the public API may have breaking changes in minor version bumps, in keeping with Cargo's pre-1.0 semver rules. Each crate in the openjd-rs workspace is versioned independently.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Security

See https://aws.amazon.com/security/vulnerability-reporting/ or email AWS Security to report a potential security issue. Please do not create a public GitHub issue.