assertions-mate validates CWL workflow inputs against assertion hints embedded in the workflow definition.
It adds policy and rule checks on top of CWL typing by supporting:
- JSON Schema validation
- Rego policy validation (OPA)
- CQL2 expression validation
Documentation site: https://terradue.github.io/assertions-mate/
Documentation follows the Diataxis framework:
- Tutorials: learning-oriented walkthroughs
- How-to guides: task-focused recipes
- Reference: technical contracts and interfaces
- Explanation: design rationale and concepts
When a CWL workflow needs stricter runtime checks (business rules, policy constraints, geospatial conditions), assertions-mate lets you define them as workflow hints and evaluate them against an input payload before execution.
git clone https://github.com/Terradue/assertions-mate.git
cd assertions-mate
pip install -e .- Python
>= 3.10 - Dependencies are managed in
pyproject.toml
After installation, run:
assertions-mate path/to/workflow.cwl --inputs path/to/inputs.yamlWhat happens:
- The CWL document is loaded.
- Assertion hints are discovered from
workflow.hints. - Matching validators are built and executed against the input mapping.
- Validation issues are reported with pointer and detail messages.
The tool maps eoap: hint classes to internal validators:
eoap:JSONSchemaHinteoap:RegoPolicyHinteoap:Cql2FilterHint
hints:
- class: eoap:JSONSchemaHint
json_schema:
type: object
required: [count]
properties:
count:
type: integer
minimum: 1
- class: eoap:RegoPolicyHint
module: |
package workflow
deny contains "count must be <= 10" if {
input.count > 10
}
queries:
- data.workflow.deny[_]
- class: eoap:Cql2FilterHint
queries:
- id: cql-rule-1
cql2: "count > 0"
message: "count must be greater than zero"This project uses Hatch environments and pytest.
# Run tests
hatch run test:test-q
# Run formatting check
hatch run dev:lint
# Run lint checks with fixes
hatch run dev:checkIf you use Taskfile:
task test
task lint
task checksrc/assertions_mate/core package and CLItests/unit testsschemas/CWL hint schema definitionsdocs/notebooks and documentation sources
Apache License 2.0. See LICENSE.