Skip to content

Commit 7f99dde

Browse files
committed
add #[serde(flatten)] to some views that were missing it
1 parent 939adec commit 7f99dde

File tree

3 files changed

+155
-30
lines changed

3 files changed

+155
-30
lines changed

common/src/api/external/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,6 +1161,7 @@ pub enum VpcRouterKind {
11611161
#[derive(ObjectIdentity, Clone, Debug, Deserialize, Serialize, JsonSchema)]
11621162
pub struct VpcRouter {
11631163
/// common identifying metadata
1164+
#[serde(flatten)]
11641165
pub identity: IdentityMetadata,
11651166

11661167
pub kind: VpcRouterKind,
@@ -1364,6 +1365,7 @@ pub enum RouterRouteKind {
13641365
#[derive(ObjectIdentity, Clone, Debug, Deserialize, Serialize, JsonSchema)]
13651366
pub struct RouterRoute {
13661367
/// common identifying metadata
1368+
#[serde(flatten)]
13671369
pub identity: IdentityMetadata,
13681370

13691371
/// The VPC Router to which the route belongs.
@@ -1400,6 +1402,7 @@ pub struct RouterRouteUpdateParams {
14001402
#[derive(ObjectIdentity, Clone, Debug, Deserialize, Serialize, JsonSchema)]
14011403
pub struct VpcFirewallRule {
14021404
/// common identifying metadata
1405+
#[serde(flatten)]
14031406
pub identity: IdentityMetadata,
14041407
/// whether this rule is in effect
14051408
pub status: VpcFirewallRuleStatus,

nexus/src/external_api/views.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ impl Into<Vpc> for model::Vpc {
106106
#[derive(ObjectIdentity, Clone, Debug, Deserialize, Serialize, JsonSchema)]
107107
pub struct VpcSubnet {
108108
/** common identifying metadata */
109+
#[serde(flatten)]
109110
pub identity: IdentityMetadata,
110111

111112
/** The VPC to which the subnet belongs. */
@@ -146,6 +147,7 @@ impl Into<VpcSubnet> for model::VpcSubnet {
146147
#[derive(ObjectIdentity, Clone, Debug, Deserialize, Serialize, JsonSchema)]
147148
#[serde(rename_all = "camelCase")]
148149
pub struct Rack {
150+
#[serde(flatten)]
149151
pub identity: IdentityMetadata,
150152
}
151153

openapi/nexus.json

Lines changed: 150 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3815,12 +3815,40 @@
38153815
"description": "Client view of an [`Rack`]",
38163816
"type": "object",
38173817
"properties": {
3818-
"identity": {
3819-
"$ref": "#/components/schemas/IdentityMetadata"
3818+
"description": {
3819+
"description": "human-readable free-form text about a resource",
3820+
"type": "string"
3821+
},
3822+
"id": {
3823+
"description": "unique, immutable, system-controlled identifier for each resource",
3824+
"type": "string",
3825+
"format": "uuid"
3826+
},
3827+
"name": {
3828+
"description": "unique, mutable, user-controlled identifier for each resource",
3829+
"allOf": [
3830+
{
3831+
"$ref": "#/components/schemas/Name"
3832+
}
3833+
]
3834+
},
3835+
"timeCreated": {
3836+
"description": "timestamp when this resource was created",
3837+
"type": "string",
3838+
"format": "date-time"
3839+
},
3840+
"timeModified": {
3841+
"description": "timestamp when this resource was last modified",
3842+
"type": "string",
3843+
"format": "date-time"
38203844
}
38213845
},
38223846
"required": [
3823-
"identity"
3847+
"description",
3848+
"id",
3849+
"name",
3850+
"timeCreated",
3851+
"timeModified"
38243852
]
38253853
},
38263854
"RackResultsPage": {
@@ -4048,22 +4076,31 @@
40484076
"description": "A route defines a rule that governs where traffic should be sent based on its destination.",
40494077
"type": "object",
40504078
"properties": {
4079+
"description": {
4080+
"description": "human-readable free-form text about a resource",
4081+
"type": "string"
4082+
},
40514083
"destination": {
40524084
"$ref": "#/components/schemas/RouteDestination"
40534085
},
4054-
"identity": {
4055-
"description": "common identifying metadata",
4086+
"id": {
4087+
"description": "unique, immutable, system-controlled identifier for each resource",
4088+
"type": "string",
4089+
"format": "uuid"
4090+
},
4091+
"kind": {
4092+
"description": "Describes the kind of router. Set at creation. `read-only`",
40564093
"allOf": [
40574094
{
4058-
"$ref": "#/components/schemas/IdentityMetadata"
4095+
"$ref": "#/components/schemas/RouterRouteKind"
40594096
}
40604097
]
40614098
},
4062-
"kind": {
4063-
"description": "Describes the kind of router. Set at creation. `read-only`",
4099+
"name": {
4100+
"description": "unique, mutable, user-controlled identifier for each resource",
40644101
"allOf": [
40654102
{
4066-
"$ref": "#/components/schemas/RouterRouteKind"
4103+
"$ref": "#/components/schemas/Name"
40674104
}
40684105
]
40694106
},
@@ -4074,14 +4111,28 @@
40744111
},
40754112
"target": {
40764113
"$ref": "#/components/schemas/RouteTarget"
4114+
},
4115+
"timeCreated": {
4116+
"description": "timestamp when this resource was created",
4117+
"type": "string",
4118+
"format": "date-time"
4119+
},
4120+
"timeModified": {
4121+
"description": "timestamp when this resource was last modified",
4122+
"type": "string",
4123+
"format": "date-time"
40774124
}
40784125
},
40794126
"required": [
4127+
"description",
40804128
"destination",
4081-
"identity",
4129+
"id",
40824130
"kind",
4131+
"name",
40834132
"router_id",
4084-
"target"
4133+
"target",
4134+
"timeCreated",
4135+
"timeModified"
40854136
]
40864137
},
40874138
"RouterRouteCreateParams": {
@@ -4633,6 +4684,10 @@
46334684
}
46344685
]
46354686
},
4687+
"description": {
4688+
"description": "human-readable free-form text about a resource",
4689+
"type": "string"
4690+
},
46364691
"direction": {
46374692
"description": "whether this rule is for incoming or outgoing traffic",
46384693
"allOf": [
@@ -4649,11 +4704,16 @@
46494704
}
46504705
]
46514706
},
4652-
"identity": {
4653-
"description": "common identifying metadata",
4707+
"id": {
4708+
"description": "unique, immutable, system-controlled identifier for each resource",
4709+
"type": "string",
4710+
"format": "uuid"
4711+
},
4712+
"name": {
4713+
"description": "unique, mutable, user-controlled identifier for each resource",
46544714
"allOf": [
46554715
{
4656-
"$ref": "#/components/schemas/IdentityMetadata"
4716+
"$ref": "#/components/schemas/Name"
46574717
}
46584718
]
46594719
},
@@ -4677,16 +4737,30 @@
46774737
"items": {
46784738
"$ref": "#/components/schemas/VpcFirewallRuleTarget"
46794739
}
4740+
},
4741+
"timeCreated": {
4742+
"description": "timestamp when this resource was created",
4743+
"type": "string",
4744+
"format": "date-time"
4745+
},
4746+
"timeModified": {
4747+
"description": "timestamp when this resource was last modified",
4748+
"type": "string",
4749+
"format": "date-time"
46804750
}
46814751
},
46824752
"required": [
46834753
"action",
4754+
"description",
46844755
"direction",
46854756
"filters",
4686-
"identity",
4757+
"id",
4758+
"name",
46874759
"priority",
46884760
"status",
4689-
"targets"
4761+
"targets",
4762+
"timeCreated",
4763+
"timeModified"
46904764
]
46914765
},
46924766
"VpcFirewallRuleAction": {
@@ -5028,16 +5102,35 @@
50285102
"description": "A VPC router defines a series of rules that indicate where traffic should be sent depending on its destination.",
50295103
"type": "object",
50305104
"properties": {
5031-
"identity": {
5032-
"description": "common identifying metadata",
5105+
"description": {
5106+
"description": "human-readable free-form text about a resource",
5107+
"type": "string"
5108+
},
5109+
"id": {
5110+
"description": "unique, immutable, system-controlled identifier for each resource",
5111+
"type": "string",
5112+
"format": "uuid"
5113+
},
5114+
"kind": {
5115+
"$ref": "#/components/schemas/VpcRouterKind"
5116+
},
5117+
"name": {
5118+
"description": "unique, mutable, user-controlled identifier for each resource",
50335119
"allOf": [
50345120
{
5035-
"$ref": "#/components/schemas/IdentityMetadata"
5121+
"$ref": "#/components/schemas/Name"
50365122
}
50375123
]
50385124
},
5039-
"kind": {
5040-
"$ref": "#/components/schemas/VpcRouterKind"
5125+
"timeCreated": {
5126+
"description": "timestamp when this resource was created",
5127+
"type": "string",
5128+
"format": "date-time"
5129+
},
5130+
"timeModified": {
5131+
"description": "timestamp when this resource was last modified",
5132+
"type": "string",
5133+
"format": "date-time"
50415134
},
50425135
"vpc_id": {
50435136
"description": "The VPC to which the router belongs.",
@@ -5046,8 +5139,12 @@
50465139
}
50475140
},
50485141
"required": [
5049-
"identity",
5142+
"description",
5143+
"id",
50505144
"kind",
5145+
"name",
5146+
"timeCreated",
5147+
"timeModified",
50515148
"vpc_id"
50525149
]
50535150
},
@@ -5117,13 +5214,14 @@
51175214
"description": "A VPC subnet represents a logical grouping for instances that allows network traffic between them, within a IPv4 subnetwork or optionall an IPv6 subnetwork.",
51185215
"type": "object",
51195216
"properties": {
5120-
"identity": {
5121-
"description": "common identifying metadata",
5122-
"allOf": [
5123-
{
5124-
"$ref": "#/components/schemas/IdentityMetadata"
5125-
}
5126-
]
5217+
"description": {
5218+
"description": "human-readable free-form text about a resource",
5219+
"type": "string"
5220+
},
5221+
"id": {
5222+
"description": "unique, immutable, system-controlled identifier for each resource",
5223+
"type": "string",
5224+
"format": "uuid"
51275225
},
51285226
"ipv4_block": {
51295227
"nullable": true,
@@ -5143,14 +5241,36 @@
51435241
}
51445242
]
51455243
},
5244+
"name": {
5245+
"description": "unique, mutable, user-controlled identifier for each resource",
5246+
"allOf": [
5247+
{
5248+
"$ref": "#/components/schemas/Name"
5249+
}
5250+
]
5251+
},
5252+
"timeCreated": {
5253+
"description": "timestamp when this resource was created",
5254+
"type": "string",
5255+
"format": "date-time"
5256+
},
5257+
"timeModified": {
5258+
"description": "timestamp when this resource was last modified",
5259+
"type": "string",
5260+
"format": "date-time"
5261+
},
51465262
"vpc_id": {
51475263
"description": "The VPC to which the subnet belongs.",
51485264
"type": "string",
51495265
"format": "uuid"
51505266
}
51515267
},
51525268
"required": [
5153-
"identity",
5269+
"description",
5270+
"id",
5271+
"name",
5272+
"timeCreated",
5273+
"timeModified",
51545274
"vpc_id"
51555275
]
51565276
},

0 commit comments

Comments
 (0)