mirror of
https://github.com/gorules/zen.git
synced 2026-10-04 08:02:28 +00:00
refactor: decision graph; move validation logic to core; (#78)
This commit is contained in:
@@ -43,4 +43,13 @@ impl PyZenDecision {
|
||||
let value = serde_json::to_value(&result).context("Fail")?;
|
||||
Ok(PyValue(value).to_object(py))
|
||||
}
|
||||
|
||||
pub fn validate(&self) -> PyResult<()> {
|
||||
let decision = self.0.clone();
|
||||
decision
|
||||
.validate()
|
||||
.map_err(|e| anyhow!(serde_json::to_string(&e).unwrap_or_else(|_| e.to_string())))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user