fix: restore yaml import and async job result contracts
This commit is contained in:
@@ -26,7 +26,7 @@ pub struct Agent {
|
||||
pub created_at: OffsetDateTime,
|
||||
#[serde(with = "time::serde::rfc3339")]
|
||||
pub updated_at: OffsetDateTime,
|
||||
#[serde(with = "time::serde::rfc3339::option")]
|
||||
#[serde(default, with = "time::serde::rfc3339::option")]
|
||||
pub published_at: Option<OffsetDateTime>,
|
||||
}
|
||||
|
||||
|
||||
@@ -236,7 +236,7 @@ pub struct Operation<TSchema, TMapping> {
|
||||
pub created_at: OffsetDateTime,
|
||||
#[serde(with = "time::serde::rfc3339")]
|
||||
pub updated_at: OffsetDateTime,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[serde(with = "time::serde::rfc3339::option")]
|
||||
pub published_at: Option<OffsetDateTime>,
|
||||
}
|
||||
@@ -517,4 +517,46 @@ mod tests {
|
||||
assert!(yaml.contains("export_mode: portable"));
|
||||
assert_eq!(restored, operation);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn operation_yaml_deserializes_without_optional_published_at() {
|
||||
let yaml = r#"
|
||||
id: op_01
|
||||
name: crm_create_lead
|
||||
display_name: Create Lead
|
||||
category: sales
|
||||
protocol: rest
|
||||
status: draft
|
||||
version: 1
|
||||
target:
|
||||
kind: rest
|
||||
base_url: https://api.example.com
|
||||
method: POST
|
||||
path_template: /v1/leads
|
||||
static_headers: {}
|
||||
input_schema:
|
||||
type: object
|
||||
output_schema:
|
||||
type: object
|
||||
input_mapping:
|
||||
rules: []
|
||||
output_mapping:
|
||||
rules: []
|
||||
execution_config:
|
||||
timeout_ms: 10000
|
||||
headers: {}
|
||||
tool_description:
|
||||
title: Create CRM lead
|
||||
description: Creates a new lead.
|
||||
tags: []
|
||||
examples: []
|
||||
created_at: 2026-03-25T08:00:00Z
|
||||
updated_at: 2026-03-25T08:10:00Z
|
||||
"#;
|
||||
|
||||
let restored: Operation<serde_json::Value, serde_json::Value> =
|
||||
serde_yaml::from_str(yaml).unwrap();
|
||||
|
||||
assert_eq!(restored.published_at, None);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user