Add #[serde(deny_unknown_fields)] to action structs that didn't have it (#33679)

Release Notes:

- N/A
This commit is contained in:
Michael Sloan 2025-06-30 18:20:02 -06:00 committed by GitHub
parent c74ecb4654
commit f022a13091
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 16 additions and 1 deletions

View file

@ -92,6 +92,7 @@ actions!(
#[derive(Default, Clone, PartialEq, Deserialize, JsonSchema, Action)] #[derive(Default, Clone, PartialEq, Deserialize, JsonSchema, Action)]
#[action(namespace = agent)] #[action(namespace = agent)]
#[serde(deny_unknown_fields)]
pub struct NewThread { pub struct NewThread {
#[serde(default)] #[serde(default)]
from_thread_id: Option<ThreadId>, from_thread_id: Option<ThreadId>,
@ -99,6 +100,7 @@ pub struct NewThread {
#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)] #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
#[action(namespace = agent)] #[action(namespace = agent)]
#[serde(deny_unknown_fields)]
pub struct ManageProfiles { pub struct ManageProfiles {
#[serde(default)] #[serde(default)]
pub customize_tools: Option<AgentProfileId>, pub customize_tools: Option<AgentProfileId>,

View file

@ -65,6 +65,7 @@ actions!(
#[derive(Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Action)] #[derive(Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Action)]
#[action(namespace = git, deprecated_aliases = ["editor::RevertFile"])] #[action(namespace = git, deprecated_aliases = ["editor::RevertFile"])]
#[serde(deny_unknown_fields)]
pub struct RestoreFile { pub struct RestoreFile {
#[serde(default)] #[serde(default)]
pub skip_prompt: bool, pub skip_prompt: bool,

View file

@ -16,9 +16,11 @@ fn test_action_macros() {
#[derive(PartialEq, Clone, Deserialize, JsonSchema, Action)] #[derive(PartialEq, Clone, Deserialize, JsonSchema, Action)]
#[action(namespace = test_only)] #[action(namespace = test_only)]
struct AnotherSomeAction; #[serde(deny_unknown_fields)]
struct AnotherAction;
#[derive(PartialEq, Clone, gpui::private::serde_derive::Deserialize)] #[derive(PartialEq, Clone, gpui::private::serde_derive::Deserialize)]
#[serde(deny_unknown_fields)]
struct RegisterableAction {} struct RegisterableAction {}
register_action!(RegisterableAction); register_action!(RegisterableAction);

View file

@ -31,6 +31,7 @@ impl FeatureFlag for SettingsUiFeatureFlag {
#[derive(Copy, Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Action)] #[derive(Copy, Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Action)]
#[action(namespace = zed)] #[action(namespace = zed)]
#[serde(deny_unknown_fields)]
pub struct ImportVsCodeSettings { pub struct ImportVsCodeSettings {
#[serde(default)] #[serde(default)]
pub skip_prompt: bool, pub skip_prompt: bool,
@ -38,6 +39,7 @@ pub struct ImportVsCodeSettings {
#[derive(Copy, Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Action)] #[derive(Copy, Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Action)]
#[action(namespace = zed)] #[action(namespace = zed)]
#[serde(deny_unknown_fields)]
pub struct ImportCursorSettings { pub struct ImportCursorSettings {
#[serde(default)] #[serde(default)]
pub skip_prompt: bool, pub skip_prompt: bool,

View file

@ -288,6 +288,7 @@ actions!(
#[derive(Default, PartialEq, Eq, Clone, Deserialize, JsonSchema, Action)] #[derive(Default, PartialEq, Eq, Clone, Deserialize, JsonSchema, Action)]
#[action(namespace = file_finder, name = "Toggle")] #[action(namespace = file_finder, name = "Toggle")]
#[serde(deny_unknown_fields)]
pub struct ToggleFileFinder { pub struct ToggleFileFinder {
#[serde(default)] #[serde(default)]
pub separate_history: bool, pub separate_history: bool,

View file

@ -58,6 +58,7 @@ pub enum ExtensionCategoryFilter {
#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)] #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
#[action(namespace = zed)] #[action(namespace = zed)]
#[serde(deny_unknown_fields)]
pub struct Extensions { pub struct Extensions {
/// Filters the extensions page down to extensions that are in the specified category. /// Filters the extensions page down to extensions that are in the specified category.
#[serde(default)] #[serde(default)]
@ -66,6 +67,7 @@ pub struct Extensions {
#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)] #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
#[action(namespace = zed)] #[action(namespace = zed)]
#[serde(deny_unknown_fields)]
pub struct DecreaseBufferFontSize { pub struct DecreaseBufferFontSize {
#[serde(default)] #[serde(default)]
pub persist: bool, pub persist: bool,
@ -73,6 +75,7 @@ pub struct DecreaseBufferFontSize {
#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)] #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
#[action(namespace = zed)] #[action(namespace = zed)]
#[serde(deny_unknown_fields)]
pub struct IncreaseBufferFontSize { pub struct IncreaseBufferFontSize {
#[serde(default)] #[serde(default)]
pub persist: bool, pub persist: bool,
@ -80,6 +83,7 @@ pub struct IncreaseBufferFontSize {
#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)] #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
#[action(namespace = zed)] #[action(namespace = zed)]
#[serde(deny_unknown_fields)]
pub struct ResetBufferFontSize { pub struct ResetBufferFontSize {
#[serde(default)] #[serde(default)]
pub persist: bool, pub persist: bool,
@ -87,6 +91,7 @@ pub struct ResetBufferFontSize {
#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)] #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
#[action(namespace = zed)] #[action(namespace = zed)]
#[serde(deny_unknown_fields)]
pub struct DecreaseUiFontSize { pub struct DecreaseUiFontSize {
#[serde(default)] #[serde(default)]
pub persist: bool, pub persist: bool,
@ -94,6 +99,7 @@ pub struct DecreaseUiFontSize {
#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)] #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
#[action(namespace = zed)] #[action(namespace = zed)]
#[serde(deny_unknown_fields)]
pub struct IncreaseUiFontSize { pub struct IncreaseUiFontSize {
#[serde(default)] #[serde(default)]
pub persist: bool, pub persist: bool,
@ -101,6 +107,7 @@ pub struct IncreaseUiFontSize {
#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)] #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
#[action(namespace = zed)] #[action(namespace = zed)]
#[serde(deny_unknown_fields)]
pub struct ResetUiFontSize { pub struct ResetUiFontSize {
#[serde(default)] #[serde(default)]
pub persist: bool, pub persist: bool,