Skip to content

Commit 09c1fe9

Browse files
refactor(Common): Make ProviderHandle optional in SourceControl DTOs
Modify `SourceControlGroupUpdateDTO` and `SourceControlUpdateDTO` to make the `ProviderHandle` field optional. Change the type from `u32` to `Option<u32>` and apply `#[serde(skip_serializing_if = "Option::is_none")]` to both structs. This adjustment supports callers (specifically the SCM.rs effect) that pass the provider handle as a positional argument, allowing the DTO to be constructed without redundantly specifying the handle in the serialized payload. Update documentation comments to clarify the optional nature and usage pattern. This enhances the flexibility of the SourceControl management interface while maintaining strict PascalCase naming and strict serialization contracts defined in the Common crate.
1 parent bc9d5cf commit 09c1fe9

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

Source/SourceControlManagement/DTO/SourceControlGroupUpdateDTO.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ use serde::{Deserialize, Serialize};
1111
#[derive(Serialize, Deserialize, Debug, Clone)]
1212
#[serde(rename_all = "camelCase")]
1313
pub struct SourceControlGroupUpdateDTO {
14-
/// The handle of the provider that owns the group.
15-
pub ProviderHandle:u32,
14+
/// The handle of the provider that owns the group. Optional: callers that
15+
/// pass the handle as a positional argument may omit this field.
16+
#[serde(skip_serializing_if = "Option::is_none")]
17+
pub ProviderHandle:Option<u32>,
1618

1719
/// The unique identifier for the group within its provider.
1820
#[serde(rename = "groupId")]

Source/SourceControlManagement/DTO/SourceControlUpdateDTO.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ use serde::{Deserialize, Serialize};
1111
#[derive(Serialize, Deserialize, Debug, Clone)]
1212
#[serde(rename_all = "camelCase")]
1313
pub struct SourceControlUpdateDTO {
14-
/// The handle of the provider to update.
15-
pub ProviderHandle:u32,
14+
/// The handle of the provider to update. Optional: callers that pass the
15+
/// handle as a positional argument (SCM.rs effect) may omit this field.
16+
#[serde(skip_serializing_if = "Option::is_none")]
17+
pub ProviderHandle:Option<u32>,
1618

1719
/// The new value for the commit message input box.
1820
#[serde(skip_serializing_if = "Option::is_none")]

0 commit comments

Comments
 (0)