From 8c8ed8586cee7fedb5935e6d3a2fedd5252cd309 Mon Sep 17 00:00:00 2001 From: Matthew Sanabria Date: Thu, 26 Jun 2025 19:02:47 -0400 Subject: [PATCH] generate: add network types to nullable exception Added network types to the nullable exception. Co-authored-by: Levon Tarver <11586085+internet-diglett@users.noreply.github.com> --- internal/generate/exceptions.go | 3 +++ internal/generate/main.go | 3 ++- oxide/types.go | 6 +++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/internal/generate/exceptions.go b/internal/generate/exceptions.go index 4c67159..4444206 100644 --- a/internal/generate/exceptions.go +++ b/internal/generate/exceptions.go @@ -26,5 +26,8 @@ func nullable() []string { // the usage of this type. Remove when this is fixed in the upstream API return []string{ "InstanceDiskAttachment", + "LldpLinkConfig", + "TxEqConfig", + "TxEqConfig2", } } diff --git a/internal/generate/main.go b/internal/generate/main.go index fc72cf1..0239baf 100644 --- a/internal/generate/main.go +++ b/internal/generate/main.go @@ -9,6 +9,7 @@ import ( "net/url" "os" "path/filepath" + "strings" "github.com/getkin/kin-openapi/openapi3" ) @@ -58,7 +59,7 @@ func loadAPIFromFile(file string) (*openapi3.T, error) { if err != nil { return nil, fmt.Errorf("error retrieving Omicron version: %v", err) } - ov := string(omicronVersion) + ov := strings.TrimSpace(string(omicronVersion)) // TODO: actually host the spec here. // uri := "https://api.oxide.computer" diff --git a/oxide/types.go b/oxide/types.go index f25105c..501fc19 100644 --- a/oxide/types.go +++ b/oxide/types.go @@ -4401,7 +4401,7 @@ type LinkConfigCreate struct { // Speed is the speed of the link. Speed LinkSpeed `json:"speed,omitempty" yaml:"speed,omitempty"` // TxEq is optional tx_eq settings. - TxEq TxEqConfig `json:"tx_eq,omitempty" yaml:"tx_eq,omitempty"` + TxEq *TxEqConfig `json:"tx_eq,omitempty" yaml:"tx_eq,omitempty"` } // LinkFec is firecode forward error correction. @@ -6237,7 +6237,7 @@ type SwitchPortLinkConfig struct { // LinkName is the name of this link. LinkName Name `json:"link_name,omitempty" yaml:"link_name,omitempty"` // LldpLinkConfig is the link-layer discovery protocol service configuration for this link. - LldpLinkConfig LldpLinkConfig `json:"lldp_link_config,omitempty" yaml:"lldp_link_config,omitempty"` + LldpLinkConfig *LldpLinkConfig `json:"lldp_link_config,omitempty" yaml:"lldp_link_config,omitempty"` // Mtu is the maximum transmission unit for this link. Mtu *int `json:"mtu,omitempty" yaml:"mtu,omitempty"` // PortSettingsId is the port settings this link configuration belongs to. @@ -6245,7 +6245,7 @@ type SwitchPortLinkConfig struct { // Speed is the configured speed of the link. Speed LinkSpeed `json:"speed,omitempty" yaml:"speed,omitempty"` // TxEqConfig is the tx_eq configuration for this link. - TxEqConfig TxEqConfig2 `json:"tx_eq_config,omitempty" yaml:"tx_eq_config,omitempty"` + TxEqConfig *TxEqConfig2 `json:"tx_eq_config,omitempty" yaml:"tx_eq_config,omitempty"` } // SwitchPortResultsPage is a single page of results