pub struct Flow {
pub name: Option<String>,
pub description: Option<String>,
pub version: Option<String>,
pub schemas: FlowSchema,
pub steps: Vec<Step>,
pub output: ValueExpr,
pub test: Option<TestConfig>,
pub examples: Option<Vec<ExampleInput>>,
pub metadata: HashMap<String, Value>,
}Expand description
A workflow consisting of a sequence of steps and their outputs.
A flow represents a complete workflow that can be executed. It contains:
- A sequence of steps to execute
- Named outputs that can reference step outputs
Flows should not be cloned. They should generally be stored and passed as a
reference or inside an Arc.
Fields§
§name: Option<String>The name of the flow.
description: Option<String>The description of the flow.
version: Option<String>The version of the flow.
schemas: FlowSchemaConsolidated schema information for the flow.
Contains input/output schemas, step output schemas, and shared $defs.
steps: Vec<Step>The steps to execute for the flow.
output: ValueExprThe outputs of the flow, mapping output names to their values.
test: Option<TestConfig>Test configuration for the flow.
examples: Option<Vec<ExampleInput>>Example inputs for the workflow that can be used for testing and UI dropdowns.
metadata: HashMap<String, Value>Extensible metadata for the flow that can be used by tools and frameworks.
Implementations§
Source§impl Flow
impl Flow
Sourcepub fn slow_clone(&self) -> Self
pub fn slow_clone(&self) -> Self
Create a clone of this flow.
Warning: This method performs a deep clone of the entire workflow structure, including all steps, metadata, and configurations. This can be expensive for large workflows.
§Performance
- Cloning large workflows with many steps can be slow
- Consider using
Arc<Flow>for shared ownership instead - Only use this when you need to modify the workflow structure
§Example
use stepflow_core::workflow::Flow;
let original_flow = Flow::default();
let cloned_flow = original_flow.slow_clone();pub fn name(&self) -> Option<&str>
pub fn description(&self) -> Option<&str>
pub fn version(&self) -> Option<&str>
pub fn metadata(&self) -> &HashMap<String, Value>
pub fn examples(&self) -> &[ExampleInput]
Sourcepub fn variables(&self) -> Option<VariableSchema>
pub fn variables(&self) -> Option<VariableSchema>
Get the variable schema for the flow.
This constructs a VariableSchema from the schema definition, extracting
runtime metadata like defaults, secrets, and required variables.
Sourcepub fn variable_schema(&self) -> Option<&SchemaRef>
pub fn variable_schema(&self) -> Option<&SchemaRef>
Get a reference to the variable schema (raw SchemaRef).
Sourcepub fn step_mut(&mut self, index: usize) -> &mut Step
pub fn step_mut(&mut self, index: usize) -> &mut Step
Returns a mutable reference to the step at the given index.
§Panics
Panics if the index is out of bounds.
pub fn test(&self) -> Option<&TestConfig>
pub fn test_mut(&mut self) -> Option<&mut TestConfig>
Sourcepub fn schemas(&self) -> &FlowSchema
pub fn schemas(&self) -> &FlowSchema
Get the flow’s schema information.
Sourcepub fn schemas_mut(&mut self) -> &mut FlowSchema
pub fn schemas_mut(&mut self) -> &mut FlowSchema
Get a mutable reference to the flow’s schema information.
Sourcepub fn input_schema(&self) -> Option<&SchemaRef>
pub fn input_schema(&self) -> Option<&SchemaRef>
Get the flow’s input schema.
Sourcepub fn set_input_schema(&mut self, input_schema: Option<SchemaRef>)
pub fn set_input_schema(&mut self, input_schema: Option<SchemaRef>)
Set the flow’s input schema.
Sourcepub fn output_schema(&self) -> Option<&SchemaRef>
pub fn output_schema(&self) -> Option<&SchemaRef>
Get the flow’s output schema.
Sourcepub fn set_output_schema(&mut self, output_schema: Option<SchemaRef>)
pub fn set_output_schema(&mut self, output_schema: Option<SchemaRef>)
Set the flow’s output schema.
Sourcepub fn step_output_schema(&self, step_id: &str) -> Option<&SchemaRef>
pub fn step_output_schema(&self, step_id: &str) -> Option<&SchemaRef>
Get the output schema for a specific step.
Sourcepub fn set_step_output_schema(
&mut self,
step_id: String,
step_schema: SchemaRef,
)
pub fn set_step_output_schema( &mut self, step_id: String, step_schema: SchemaRef, )
Set the output schema for a specific step.
Sourcepub fn get_all_examples(&self) -> Vec<ExampleInput>
pub fn get_all_examples(&self) -> Vec<ExampleInput>
Get all example inputs, including those derived from test cases.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Flow
impl<'de> Deserialize<'de> for Flow
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for Flow
impl JsonSchema for Flow
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more