mirror of
https://github.com/gorules/zen.git
synced 2026-10-05 00:02:26 +00:00
change validator to string
This commit is contained in:
@@ -205,10 +205,15 @@ impl<L: DecisionLoader + 'static, A: CustomNodeAdapter + 'static> DecisionGraph<
|
||||
trace_data: None,
|
||||
});
|
||||
|
||||
if let Some(json_schema) = &content.schema {
|
||||
if let Some(json_schema) = content
|
||||
.schema
|
||||
.as_ref()
|
||||
.map(|s| serde_json::from_str::<Value>(&s).ok())
|
||||
.flatten()
|
||||
{
|
||||
let validator = self
|
||||
.validator_cache
|
||||
.get_or_insert(node.id.as_str(), json_schema)
|
||||
.get_or_insert(node.id.as_str(), &json_schema)
|
||||
.await
|
||||
.map_err(|e| NodeError {
|
||||
source: e.into(),
|
||||
@@ -238,10 +243,15 @@ impl<L: DecisionLoader + 'static, A: CustomNodeAdapter + 'static> DecisionGraph<
|
||||
trace_data: None,
|
||||
});
|
||||
|
||||
if let Some(json_schema) = &content.schema {
|
||||
if let Some(json_schema) = content
|
||||
.schema
|
||||
.as_ref()
|
||||
.map(|s| serde_json::from_str::<Value>(&s).ok())
|
||||
.flatten()
|
||||
{
|
||||
let validator = self
|
||||
.validator_cache
|
||||
.get_or_insert(node.id.as_str(), json_schema)
|
||||
.get_or_insert(node.id.as_str(), &json_schema)
|
||||
.await
|
||||
.map_err(|e| NodeError {
|
||||
source: e.into(),
|
||||
|
||||
@@ -71,13 +71,15 @@ pub enum DecisionNodeKind {
|
||||
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize, Default)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct InputNodeContent {
|
||||
pub schema: Option<Value>,
|
||||
#[serde(default, deserialize_with = "empty_string_is_none")]
|
||||
pub schema: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize, Default)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct OutputNodeContent {
|
||||
pub schema: Option<Value>,
|
||||
#[serde(default, deserialize_with = "empty_string_is_none")]
|
||||
pub schema: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
|
||||
|
||||
Reference in New Issue
Block a user