fix(cli): site/data-connection/api-method update are preserve-if-null partial updates (CLI-2, WP2 task 2.8)
Decision 2.8: preserve-if-null on the server. UpdateSiteCommand, UpdateDataConnectionCommand and UpdateApiMethodCommand fields (except the id) are now nullable; the ManagementActor handlers apply only non-null values and treat an empty string as 'clear this optional field'. The CLI update commands no longer require --name/--protocol/--script and drop the --failover-retry-count (3) and --timeout (30) defaults, so an omitted option travels as null instead of overwriting the stored value (site update --name used to null both gRPC addresses). The site gRPC-address validation now runs on the merged values. Additive/compatible: the fields only became nullable, so an older CLI that always sends every field still deserializes (pinned by a test) and now simply updates every field as before. The Central UI full-entity forms send "" for a field the operator cleared (description/addresses, removed backup endpoint, cleared parameter/return definitions) so clearing keeps working.
This commit is contained in:
@@ -3,7 +3,12 @@ namespace ZB.MOM.WW.ScadaBridge.Commons.Messages.Management;
|
||||
public record ListDataConnectionsCommand(int? SiteId = null);
|
||||
public record GetDataConnectionCommand(int DataConnectionId);
|
||||
public record CreateDataConnectionCommand(int SiteId, string Name, string Protocol, string? PrimaryConfiguration, string? BackupConfiguration = null, int FailoverRetryCount = 3);
|
||||
public record UpdateDataConnectionCommand(int DataConnectionId, string Name, string Protocol, string? PrimaryConfiguration, string? BackupConfiguration = null, int FailoverRetryCount = 3);
|
||||
/// <summary>
|
||||
/// Partial update (CLI-2): every field except the id is preserve-if-null — <c>null</c> leaves the
|
||||
/// stored value unchanged; an empty string clears an optional field. Older clients that always
|
||||
/// send every field keep deserializing unchanged (the fields only became nullable).
|
||||
/// </summary>
|
||||
public record UpdateDataConnectionCommand(int DataConnectionId, string? Name, string? Protocol, string? PrimaryConfiguration, string? BackupConfiguration = null, int? FailoverRetryCount = null);
|
||||
public record DeleteDataConnectionCommand(int DataConnectionId);
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -4,8 +4,13 @@ public record ListApiMethodsCommand;
|
||||
public record GetApiMethodCommand(int ApiMethodId);
|
||||
/// <param name="TraceAllCalls">Flow Debugger (design 2026-09-05 §5.2): trace every production call to this method. Additive; defaults to off.</param>
|
||||
public record CreateApiMethodCommand(string Name, string Script, int TimeoutSeconds, string? ParameterDefinitions, string? ReturnDefinition, bool TraceAllCalls = false);
|
||||
/// <summary>
|
||||
/// Partial update (CLI-2): every field except the id is preserve-if-null — <c>null</c> leaves the
|
||||
/// stored value unchanged; an empty string clears an optional field. Older clients that always
|
||||
/// send every field keep deserializing unchanged (the fields only became nullable).
|
||||
/// </summary>
|
||||
/// <param name="TraceAllCalls">Flow Debugger (design 2026-09-05 §5.2): <c>null</c> leaves the stored value unchanged so an older CLI never resets it.</param>
|
||||
public record UpdateApiMethodCommand(int ApiMethodId, string Script, int TimeoutSeconds, string? ParameterDefinitions, string? ReturnDefinition, bool? TraceAllCalls = null);
|
||||
public record UpdateApiMethodCommand(int ApiMethodId, string? Script, int? TimeoutSeconds, string? ParameterDefinitions, string? ReturnDefinition, bool? TraceAllCalls = null);
|
||||
public record DeleteApiMethodCommand(int ApiMethodId);
|
||||
/// <summary>
|
||||
/// Compiles the method's stored script on the receiving central node and returns the
|
||||
|
||||
@@ -3,7 +3,12 @@ namespace ZB.MOM.WW.ScadaBridge.Commons.Messages.Management;
|
||||
public record ListSitesCommand;
|
||||
public record GetSiteCommand(int SiteId);
|
||||
public record CreateSiteCommand(string Name, string SiteIdentifier, string? Description, string? NodeAAddress = null, string? NodeBAddress = null, string? GrpcNodeAAddress = null, string? GrpcNodeBAddress = null);
|
||||
public record UpdateSiteCommand(int SiteId, string Name, string? Description, string? NodeAAddress = null, string? NodeBAddress = null, string? GrpcNodeAAddress = null, string? GrpcNodeBAddress = null);
|
||||
/// <summary>
|
||||
/// Partial update (CLI-2): every field except the id is preserve-if-null — <c>null</c> leaves the
|
||||
/// stored value unchanged; an empty string clears an optional field. Older clients that always
|
||||
/// send every field keep deserializing unchanged (the fields only became nullable).
|
||||
/// </summary>
|
||||
public record UpdateSiteCommand(int SiteId, string? Name, string? Description, string? NodeAAddress = null, string? NodeBAddress = null, string? GrpcNodeAAddress = null, string? GrpcNodeBAddress = null);
|
||||
public record DeleteSiteCommand(int SiteId);
|
||||
public record ListAreasCommand(int SiteId);
|
||||
public record CreateAreaCommand(int SiteId, string Name, int? ParentAreaId);
|
||||
|
||||
Reference in New Issue
Block a user