From 1baee2070f22badd4f99179d2c8dc54f4c7f01a6 Mon Sep 17 00:00:00 2001 From: Adam Nadrowski Date: Fri, 6 Feb 2026 23:00:02 -0500 Subject: [PATCH] fix: add omitempty to Network string fields to prevent sending empty values Network create/update requests were sending empty strings for unset fields (firewall_zone_id, radiusprofile_id, usergroup_id, dhcpd_dns_*, wan_dns*, and 20+ others) because their JSON struct tags lacked omitempty. The UniFi controller interprets an explicit empty firewall_zone_id as a zone disassociation, which triggers a global zone rebuild that causes all zone policies to disappear from the UI. Co-Authored-By: Claude Opus 4.6 --- unifi/network.generated.go | 74 +++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/unifi/network.generated.go b/unifi/network.generated.go index 8b54cc8..0495f26 100644 --- a/unifi/network.generated.go +++ b/unifi/network.generated.go @@ -28,32 +28,32 @@ type Network struct { AutoScaleEnabled bool `json:"auto_scale_enabled"` DHCPDBootEnabled bool `json:"dhcpd_boot_enabled"` DHCPDBootFilename string `json:"dhcpd_boot_filename,omitempty" validate:"omitempty,gte=1,lte=256"` // .{1,256} - DHCPDBootServer string `json:"dhcpd_boot_server"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$|(?=^.{3,253}$)(^((?!-)[a-zA-Z0-9-]{1,63}(?