Skip to main content

zen_engine/nodes/output/
mod.rs

1use crate::nodes::definition::NodeHandler;
2use crate::nodes::result::NodeResult;
3use crate::nodes::NodeContext;
4use zen_types::decision::OutputNodeContent;
5use zen_types::variable::Variable;
6
7#[derive(Debug, Clone)]
8pub struct OutputNodeHandler;
9
10pub type OutputNodeData = OutputNodeContent;
11pub type OutputNodeTrace = Variable;
12
13impl NodeHandler for OutputNodeHandler {
14    type NodeData = OutputNodeData;
15    type TraceData = OutputNodeTrace;
16
17    async fn handle(&self, ctx: NodeContext<Self::NodeData, Self::TraceData>) -> NodeResult {
18        if let Some(json_schema) = &ctx.node.schema {
19            ctx.validate(json_schema, &ctx.input)?;
20        };
21
22        ctx.success(ctx.input.clone())
23    }
24}