Skip to content

Commit 62614ab

Browse files
authored
[external api] Set a default empty array for VpcFirewallRuleUpdate (#8175)
In our attempt to make the Go SDK generator less hacky oxidecomputer/oxide.go#283, we had the unexpected side effect of breaking our `VpcFirewallRuleUpdateParams` struct https://github.com/oxidecomputer/oxide.go/pull/283/files#diff-841a2b1b5f072b633551cac9c34c9732a722b415e297a1530b92d5988962062eR6810-R6811 due to Go's fun way of handling empty values. Using this API no longer allows us to delete the entirety of the firewall rules. This commit sets an empty array as the default for `rules` following the pattern that other APIs use. https://github.com/oxidecomputer/omicron/blob/main/nexus/types/src/external_api/params.rs#L1163-L1177 cc @sudomateo
1 parent c179ea6 commit 62614ab

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

common/src/api/external/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1789,6 +1789,7 @@ pub struct VpcFirewallRuleUpdate {
17891789
#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)]
17901790
pub struct VpcFirewallRuleUpdateParams {
17911791
#[schemars(length(max = 1024))]
1792+
#[serde(default)]
17921793
pub rules: Vec<VpcFirewallRuleUpdate>,
17931794
}
17941795

openapi/nexus.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25265,16 +25265,14 @@
2526525265
"type": "object",
2526625266
"properties": {
2526725267
"rules": {
25268+
"default": [],
2526825269
"type": "array",
2526925270
"items": {
2527025271
"$ref": "#/components/schemas/VpcFirewallRuleUpdate"
2527125272
},
2527225273
"maxItems": 1024
2527325274
}
25274-
},
25275-
"required": [
25276-
"rules"
25277-
]
25275+
}
2527825276
},
2527925277
"VpcFirewallRules": {
2528025278
"description": "Collection of a Vpc's firewall rules",

0 commit comments

Comments
 (0)