openjd-expr 0.1.2

Open Job Description expression language — types, evaluation, and path mapping
Documentation

openjd-expr

crates.io docs.rs license

Expression language for Open Job Description (OpenJD) templates. Part of the openjd-rs workspace — a Rust implementation of the OpenJD specification.

What this crate provides

  • Format string resolution{{Param.Foo}}, {{Task.Param.Bar}}, and {{Expr.expr}} interpolation in template fields.
  • EXPR extension expression evaluation — a subset of Python expression syntax (arithmetic, comparisons, conditionals, function calls, list comprehensions, slicing, string operations, regex, path operations) with memory- and operation-bounded execution.
  • Type system (ExprType, TypeCode) including primitives, typed lists, unions, type variables, and generics for function signatures.
  • Runtime values (ExprValue) with float-passthrough for preserving original string representations during round-trips.
  • Symbol tables with hierarchical key-value lookup and dotted paths (Param.Frame).
  • Range expressions (1-10, 1-100:10, 1,5,10-20).
  • Path mapping — applying source→destination path rules across platforms.

The parser is built on ruff_python_parser, the same Python parser Astral uses in Ruff and the OpenJD spec recommends for Rust implementations.

Minimum supported Rust version

Rust 1.92. Enforced in CI.

Quick example

use openjd_expr::{ExprValue, ParsedExpression, SymbolTable};

let parsed = ParsedExpression::new("Param.Frame * 2 + 1").unwrap();

let mut symbols = SymbolTable::new();
symbols.set("Param.Frame", 42).unwrap();

let value = parsed.evaluate(&[&symbols]).unwrap();
assert_eq!(value, ExprValue::Int(85));

For format strings:

use openjd_expr::FormatString;

let fs = FormatString::new("hello {{Param.Name}}").unwrap();

See the crate documentation on docs.rs for the full API, including evaluator resource limits, the function library, and error reporting.

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.