openjd-expr
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 ;
let parsed = new.unwrap;
let mut symbols = new;
symbols.set.unwrap;
let value = parsed.evaluate.unwrap;
assert_eq!;
For format strings:
use FormatString;
let fs = new.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
- 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.