openjd-model
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, andREDACTED_ENV_VARSextensions 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 ;
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 = default;
let value = document_string_to_object?;
let template = decode_job_template?;
assert_eq!;
# Ok::
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
- Apache License, Version 2.0 (LICENSE-Apache-2.0 or http://www.apache.org/licenses/LICENSE-2.0)
- MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)
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.