From adeaed303f351b988222a82ce0cc3014ad96c324 Mon Sep 17 00:00:00 2001 From: haixuanTao Date: Thu, 16 Mar 2023 12:20:41 +0100 Subject: [PATCH 1/2] Deny unknown field to avoid typography --- libraries/core/src/descriptor/mod.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libraries/core/src/descriptor/mod.rs b/libraries/core/src/descriptor/mod.rs index 8dfdc689..69c0ba81 100644 --- a/libraries/core/src/descriptor/mod.rs +++ b/libraries/core/src/descriptor/mod.rs @@ -92,6 +92,7 @@ impl Descriptor { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] pub struct Node { pub id: NodeId, pub name: Option, @@ -113,6 +114,7 @@ pub enum NodeKind { } #[derive(Debug, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] pub struct ResolvedNode { pub id: NodeId, pub name: Option, @@ -139,6 +141,7 @@ pub struct RuntimeNode { } #[derive(Debug, Serialize, Deserialize, Clone)] +#[serde(deny_unknown_fields)] pub struct OperatorDefinition { pub id: OperatorId, #[serde(flatten)] @@ -146,6 +149,7 @@ pub struct OperatorDefinition { } #[derive(Debug, Serialize, Deserialize, Clone)] +#[serde(deny_unknown_fields)] pub struct SingleOperatorDefinition { /// ID is optional if there is only a single operator. pub id: Option, @@ -154,6 +158,7 @@ pub struct SingleOperatorDefinition { } #[derive(Debug, Serialize, Deserialize, Clone)] +#[serde(deny_unknown_fields)] pub struct OperatorConfig { pub name: Option, pub description: Option, @@ -202,6 +207,7 @@ pub fn resolve_path(source: &str, working_dir: &Path) -> Result { } #[derive(Debug, Serialize, Deserialize, Clone)] +#[serde(deny_unknown_fields)] pub struct PythonOperatorConfig { pub path: PathBuf, #[serde(default)] @@ -211,6 +217,7 @@ pub struct PythonOperatorConfig { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] pub struct CustomNode { pub source: String, #[serde(default, skip_serializing_if = "Option::is_none")] From 47e540fbe1f906c40179ef558e0fc2ad94182a38 Mon Sep 17 00:00:00 2001 From: haixuanTao Date: Thu, 16 Mar 2023 13:01:21 +0100 Subject: [PATCH 2/2] fix `build` field error --- libraries/core/src/descriptor/mod.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/libraries/core/src/descriptor/mod.rs b/libraries/core/src/descriptor/mod.rs index 69c0ba81..3af99dda 100644 --- a/libraries/core/src/descriptor/mod.rs +++ b/libraries/core/src/descriptor/mod.rs @@ -92,7 +92,6 @@ impl Descriptor { } #[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(deny_unknown_fields)] pub struct Node { pub id: NodeId, pub name: Option, @@ -114,7 +113,6 @@ pub enum NodeKind { } #[derive(Debug, Serialize, Deserialize)] -#[serde(deny_unknown_fields)] pub struct ResolvedNode { pub id: NodeId, pub name: Option, @@ -141,7 +139,6 @@ pub struct RuntimeNode { } #[derive(Debug, Serialize, Deserialize, Clone)] -#[serde(deny_unknown_fields)] pub struct OperatorDefinition { pub id: OperatorId, #[serde(flatten)] @@ -149,7 +146,6 @@ pub struct OperatorDefinition { } #[derive(Debug, Serialize, Deserialize, Clone)] -#[serde(deny_unknown_fields)] pub struct SingleOperatorDefinition { /// ID is optional if there is only a single operator. pub id: Option,