Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Add `#[serde(deny_unknown_fields)]` to action structs that didn't have it (#33679)
Michael Sloanf022a130912d
diff --git a/crates/agent_ui/src/agent_ui.rs b/crates/agent_ui/src/agent_ui.rsindex 29a4f38487b..0ba3d07f996 100644--- a/crates/agent_ui/src/agent_ui.rs+++ b/crates/agent_ui/src/agent_ui.rs@@ -92,6 +92,7 @@ actions!(#[derive(Default, Clone, PartialEq, Deserialize, JsonSchema, Action)]#[action(namespace = agent)]+#[serde(deny_unknown_fields)]pub struct NewThread {#[serde(default)]from_thread_id: Option<ThreadId>,@@ -99,6 +100,7 @@ pub struct NewThread {#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]#[action(namespace = agent)]+#[serde(deny_unknown_fields)]pub struct ManageProfiles {#[serde(default)]pub customize_tools: Option<AgentProfileId>,diff --git a/crates/git/src/git.rs b/crates/git/src/git.rsindex bb8f39f127f..d64d35b7894 100644--- a/crates/git/src/git.rs+++ b/crates/git/src/git.rs@@ -65,6 +65,7 @@ actions!(#[derive(Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Action)]#[action(namespace = git, deprecated_aliases = ["editor::RevertFile"])]+#[serde(deny_unknown_fields)]pub struct RestoreFile {#[serde(default)]pub skip_prompt: bool,diff --git a/crates/gpui/tests/action_macros.rs b/crates/gpui/tests/action_macros.rsindex f601639fc8d..7bff3a97b1c 100644--- a/crates/gpui/tests/action_macros.rs+++ b/crates/gpui/tests/action_macros.rs@@ -16,9 +16,11 @@ fn test_action_macros() {#[derive(PartialEq, Clone, Deserialize, JsonSchema, Action)]#[action(namespace = test_only)]- struct AnotherSomeAction;+ #[serde(deny_unknown_fields)]+ struct AnotherAction;#[derive(PartialEq, Clone, gpui::private::serde_derive::Deserialize)]+ #[serde(deny_unknown_fields)]struct RegisterableAction {}register_action!(RegisterableAction);diff --git a/crates/settings_ui/src/settings_ui.rs b/crates/settings_ui/src/settings_ui.rsindex b3fb10c5e68..28ffb1ab4a3 100644--- a/crates/settings_ui/src/settings_ui.rs+++ b/crates/settings_ui/src/settings_ui.rs@@ -31,6 +31,7 @@ impl FeatureFlag for SettingsUiFeatureFlag {#[derive(Copy, Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Action)]#[action(namespace = zed)]+#[serde(deny_unknown_fields)]pub struct ImportVsCodeSettings {#[serde(default)]pub skip_prompt: bool,@@ -38,6 +39,7 @@ pub struct ImportVsCodeSettings {#[derive(Copy, Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Action)]#[action(namespace = zed)]+#[serde(deny_unknown_fields)]pub struct ImportCursorSettings {#[serde(default)]pub skip_prompt: bool,diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rsindex 38532292435..7c5355bfd1b 100644--- a/crates/workspace/src/workspace.rs+++ b/crates/workspace/src/workspace.rs@@ -288,6 +288,7 @@ actions!(#[derive(Default, PartialEq, Eq, Clone, Deserialize, JsonSchema, Action)]#[action(namespace = file_finder, name = "Toggle")]+#[serde(deny_unknown_fields)]pub struct ToggleFileFinder {#[serde(default)]pub separate_history: bool,diff --git a/crates/zed_actions/src/lib.rs b/crates/zed_actions/src/lib.rsindex b8c52e27e83..fa852084d60 100644--- a/crates/zed_actions/src/lib.rs+++ b/crates/zed_actions/src/lib.rs@@ -58,6 +58,7 @@ pub enum ExtensionCategoryFilter {#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]#[action(namespace = zed)]+#[serde(deny_unknown_fields)]pub struct Extensions {/// Filters the extensions page down to extensions that are in the specified category.#[serde(default)]@@ -66,6 +67,7 @@ pub struct Extensions {#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]#[action(namespace = zed)]+#[serde(deny_unknown_fields)]pub struct DecreaseBufferFontSize {#[serde(default)]pub persist: bool,@@ -73,6 +75,7 @@ pub struct DecreaseBufferFontSize {#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]#[action(namespace = zed)]+#[serde(deny_unknown_fields)]pub struct IncreaseBufferFontSize {#[serde(default)]pub persist: bool,@@ -80,6 +83,7 @@ pub struct IncreaseBufferFontSize {#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]#[action(namespace = zed)]+#[serde(deny_unknown_fields)]pub struct ResetBufferFontSize {#[serde(default)]pub persist: bool,@@ -87,6 +91,7 @@ pub struct ResetBufferFontSize {#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]#[action(namespace = zed)]+#[serde(deny_unknown_fields)]pub struct DecreaseUiFontSize {#[serde(default)]pub persist: bool,@@ -94,6 +99,7 @@ pub struct DecreaseUiFontSize {#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]#[action(namespace = zed)]+#[serde(deny_unknown_fields)]pub struct IncreaseUiFontSize {#[serde(default)]pub persist: bool,@@ -101,6 +107,7 @@ pub struct IncreaseUiFontSize {#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]#[action(namespace = zed)]+#[serde(deny_unknown_fields)]pub struct ResetUiFontSize {#[serde(default)]pub persist: bool,