swf_core/models/task/custom_task.rs
1use serde::{Deserialize, Serialize};
2use serde_json::Value;
3
4use super::TaskDefinitionFields;
5
6/// Represents a custom/extension task definition not covered by built-in types.
7///
8/// Matches Go SDK's TaskRegistry pattern — allows users to define custom task types
9/// that are preserved during deserialization and can be handled by a CustomTaskHandler
10/// at runtime.
11#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12pub struct CustomTaskDefinition {
13 /// The task type name (e.g., "myCustomTask")
14 #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
15 pub type_: Option<String>,
16 /// The raw JSON configuration for the custom task
17 #[serde(flatten)]
18 pub config: Value,
19 /// Common task fields (if, input, output, export, timeout, then, metadata)
20 #[serde(flatten)]
21 pub common: TaskDefinitionFields,
22}