Skip to content

Commit 7c5d4b8

Browse files
authored
chore: Repair codegenerator (#1701)
openapi-core==0.23.0 dropped deprecated interface breaking the codegenerator. Work on the fix revealed some other issues that need to be fixed. Changes are triggered by https://review.opendev.org/c/openstack/codegenerator/+/981546
1 parent ef5a29a commit 7c5d4b8

43 files changed

Lines changed: 1350 additions & 554 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

openstack_cli/src/container_infrastructure_management/v1/cluster/create.rs

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -352,22 +352,38 @@ impl ClusterCommand {
352352

353353
// Set Request.labels data
354354
if let Some(arg) = &self.labels {
355-
ep_builder.labels(arg.iter().cloned());
355+
let mut data: Vec<(String, create::Labels)> = Vec::new();
356+
for (k, v) in arg.iter() {
357+
data.push((k.clone(), serde_json::from_str(v)?));
358+
}
359+
ep_builder.labels(data.into_iter());
356360
}
357361

358362
// Set Request.labels_added data
359363
if let Some(arg) = &self.labels_added {
360-
ep_builder.labels_added(arg.iter().cloned());
364+
let mut data: Vec<(String, create::LabelsAdded)> = Vec::new();
365+
for (k, v) in arg.iter() {
366+
data.push((k.clone(), serde_json::from_str(v)?));
367+
}
368+
ep_builder.labels_added(data.into_iter());
361369
}
362370

363371
// Set Request.labels_overridden data
364372
if let Some(arg) = &self.labels_overridden {
365-
ep_builder.labels_overridden(arg.iter().cloned());
373+
let mut data: Vec<(String, create::LabelsOverridden)> = Vec::new();
374+
for (k, v) in arg.iter() {
375+
data.push((k.clone(), serde_json::from_str(v)?));
376+
}
377+
ep_builder.labels_overridden(data.into_iter());
366378
}
367379

368380
// Set Request.labels_skipped data
369381
if let Some(arg) = &self.labels_skipped {
370-
ep_builder.labels_skipped(arg.iter().cloned());
382+
let mut data: Vec<(String, create::LabelsSkipped)> = Vec::new();
383+
for (k, v) in arg.iter() {
384+
data.push((k.clone(), serde_json::from_str(v)?));
385+
}
386+
ep_builder.labels_skipped(data.into_iter());
371387
}
372388

373389
// Set Request.links data

openstack_cli/src/container_infrastructure_management/v1/cluster/nodegroup/create.rs

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,22 +220,38 @@ impl NodegroupCommand {
220220

221221
// Set Request.labels data
222222
if let Some(arg) = &self.labels {
223-
ep_builder.labels(arg.iter().cloned());
223+
let mut data: Vec<(String, create::Labels)> = Vec::new();
224+
for (k, v) in arg.iter() {
225+
data.push((k.clone(), serde_json::from_str(v)?));
226+
}
227+
ep_builder.labels(data.into_iter());
224228
}
225229

226230
// Set Request.labels_added data
227231
if let Some(arg) = &self.labels_added {
228-
ep_builder.labels_added(arg.iter().cloned());
232+
let mut data: Vec<(String, create::LabelsAdded)> = Vec::new();
233+
for (k, v) in arg.iter() {
234+
data.push((k.clone(), serde_json::from_str(v)?));
235+
}
236+
ep_builder.labels_added(data.into_iter());
229237
}
230238

231239
// Set Request.labels_overridden data
232240
if let Some(arg) = &self.labels_overridden {
233-
ep_builder.labels_overridden(arg.iter().cloned());
241+
let mut data: Vec<(String, create::LabelsOverridden)> = Vec::new();
242+
for (k, v) in arg.iter() {
243+
data.push((k.clone(), serde_json::from_str(v)?));
244+
}
245+
ep_builder.labels_overridden(data.into_iter());
234246
}
235247

236248
// Set Request.labels_skipped data
237249
if let Some(arg) = &self.labels_skipped {
238-
ep_builder.labels_skipped(arg.iter().cloned());
250+
let mut data: Vec<(String, create::LabelsSkipped)> = Vec::new();
251+
for (k, v) in arg.iter() {
252+
data.push((k.clone(), serde_json::from_str(v)?));
253+
}
254+
ep_builder.labels_skipped(data.into_iter());
239255
}
240256

241257
// Set Request.links data

openstack_cli/src/container_infrastructure_management/v1/clustertemplate/create.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,11 @@ impl ClustertemplateCommand {
387387

388388
// Set Request.labels data
389389
if let Some(arg) = &self.labels {
390-
ep_builder.labels(arg.iter().cloned());
390+
let mut data: Vec<(String, create::Labels)> = Vec::new();
391+
for (k, v) in arg.iter() {
392+
data.push((k.clone(), serde_json::from_str(v)?));
393+
}
394+
ep_builder.labels(data.into_iter());
391395
}
392396

393397
// Set Request.links data

openstack_cli/src/dns/v2/zone/create.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ pub struct ZoneCommand {
5656
#[arg(help_heading = "Body parameters", long)]
5757
description: Option<String>,
5858

59-
/// e-mail for the zone. Used in SOA records for the zone
59+
/// e-mail for the zone. Used in SOA records for the zone. Mandatory for
60+
/// PRIMARY zones, forbidden for SECONDARY zones.
6061
#[arg(help_heading = "Body parameters", long)]
6162
email: Option<String>,
6263

openstack_cli/src/dns/v2/zone/set.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ pub struct ZoneCommand {
5050
#[arg(help_heading = "Body parameters", long)]
5151
description: Option<String>,
5252

53-
/// e-mail for the zone. Used in SOA records for the zone
53+
/// e-mail for the zone. Used in SOA records for the zone. Forbidden for
54+
/// SECONDARY zones.
5455
#[arg(help_heading = "Body parameters", long)]
5556
email: Option<String>,
5657

openstack_cli/src/identity/v3/endpoint/set.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ struct Endpoint {
8888
#[arg(help_heading = "Body parameters", long, action = clap::ArgAction::SetTrue, conflicts_with = "description")]
8989
no_description: bool,
9090

91-
/// Indicates whether the endpoint appears in the service catalog -false.
92-
/// The endpoint does not appear in the service catalog. -true. The
93-
/// endpoint appears in the service catalog.
91+
/// Indicates whether the endpoint appears in the service catalog: -
92+
/// `false`. The endpoint does not appear in the service catalog. - `true`.
93+
/// The endpoint appears in the service catalog.
9494
#[arg(action=clap::ArgAction::Set, help_heading = "Body parameters", long)]
9595
enabled: Option<bool>,
9696

openstack_cli/src/identity/v3/os_federation/identity_provider/protocol/create.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use openstack_types::identity::v3::os_federation::identity_provider::protocol::r
3535

3636
/// Create protocol for an IDP.
3737
///
38-
/// PUT /OS-Federation/identity_providers/{idp_id}/protocols/{protocol_id}
38+
/// PUT /OS-FEDERATION/identity_providers/{idp_id}/protocols/{protocol_id}
3939
#[derive(Args)]
4040
pub struct ProtocolCommand {
4141
/// Request Query parameters

openstack_cli/src/identity/v3/os_federation/identity_provider/protocol/set.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,6 @@ struct Protocol {
8484

8585
#[arg(help_heading = "Body parameters", long)]
8686
remote_id_attribute: Option<String>,
87-
88-
/// Set explicit NULL for the remote_id_attribute
89-
#[arg(help_heading = "Body parameters", long, action = clap::ArgAction::SetTrue, conflicts_with = "remote_id_attribute")]
90-
no_remote_id_attribute: bool,
9187
}
9288

9389
impl ProtocolCommand {
@@ -119,9 +115,7 @@ impl ProtocolCommand {
119115
protocol_builder.mapping_id(&args.mapping_id);
120116

121117
if let Some(val) = &args.remote_id_attribute {
122-
protocol_builder.remote_id_attribute(Some(val.into()));
123-
} else if args.no_remote_id_attribute {
124-
protocol_builder.remote_id_attribute(None);
118+
protocol_builder.remote_id_attribute(val);
125119
}
126120

127121
ep_builder.protocol(

openstack_sdk/src/api/container_infrastructure_management/v1/cluster/create.rs

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,38 @@ pub enum HealthStatus {
3737
Unknown,
3838
}
3939

40+
#[derive(Debug, Deserialize, Clone, Serialize)]
41+
#[serde(untagged)]
42+
pub enum Labels<'a> {
43+
F1(bool),
44+
F2(i32),
45+
F3(Cow<'a, str>),
46+
}
47+
48+
#[derive(Debug, Deserialize, Clone, Serialize)]
49+
#[serde(untagged)]
50+
pub enum LabelsAdded<'a> {
51+
F1(bool),
52+
F2(i32),
53+
F3(Cow<'a, str>),
54+
}
55+
56+
#[derive(Debug, Deserialize, Clone, Serialize)]
57+
#[serde(untagged)]
58+
pub enum LabelsOverridden<'a> {
59+
F1(bool),
60+
F2(i32),
61+
F3(Cow<'a, str>),
62+
}
63+
64+
#[derive(Debug, Deserialize, Clone, Serialize)]
65+
#[serde(untagged)]
66+
pub enum LabelsSkipped<'a> {
67+
F1(bool),
68+
F2(i32),
69+
F3(Cow<'a, str>),
70+
}
71+
4072
/// A link representation.
4173
#[derive(Builder, Debug, Deserialize, Clone, Serialize)]
4274
#[builder(setter(strip_option))]
@@ -191,16 +223,16 @@ pub struct Request<'a> {
191223
/// way to pass additional parameters that are specific to a cluster
192224
/// driver.
193225
#[builder(default, private, setter(into, name = "_labels"))]
194-
pub(crate) labels: Option<BTreeMap<Cow<'a, str>, Cow<'a, str>>>,
226+
pub(crate) labels: Option<BTreeMap<Cow<'a, str>, Labels<'a>>>,
195227

196228
#[builder(default, private, setter(into, name = "_labels_added"))]
197-
pub(crate) labels_added: Option<BTreeMap<Cow<'a, str>, Cow<'a, str>>>,
229+
pub(crate) labels_added: Option<BTreeMap<Cow<'a, str>, LabelsAdded<'a>>>,
198230

199231
#[builder(default, private, setter(into, name = "_labels_overridden"))]
200-
pub(crate) labels_overridden: Option<BTreeMap<Cow<'a, str>, Cow<'a, str>>>,
232+
pub(crate) labels_overridden: Option<BTreeMap<Cow<'a, str>, LabelsOverridden<'a>>>,
201233

202234
#[builder(default, private, setter(into, name = "_labels_skipped"))]
203-
pub(crate) labels_skipped: Option<BTreeMap<Cow<'a, str>, Cow<'a, str>>>,
235+
pub(crate) labels_skipped: Option<BTreeMap<Cow<'a, str>, LabelsSkipped<'a>>>,
204236

205237
#[builder(default, setter(into))]
206238
pub(crate) links: Option<Vec<Links<'a>>>,
@@ -310,7 +342,7 @@ impl<'a> RequestBuilder<'a> {
310342
where
311343
I: Iterator<Item = (K, V)>,
312344
K: Into<Cow<'a, str>>,
313-
V: Into<Cow<'a, str>>,
345+
V: Into<Labels<'a>>,
314346
{
315347
self.labels
316348
.get_or_insert(None)
@@ -323,7 +355,7 @@ impl<'a> RequestBuilder<'a> {
323355
where
324356
I: Iterator<Item = (K, V)>,
325357
K: Into<Cow<'a, str>>,
326-
V: Into<Cow<'a, str>>,
358+
V: Into<LabelsAdded<'a>>,
327359
{
328360
self.labels_added
329361
.get_or_insert(None)
@@ -336,7 +368,7 @@ impl<'a> RequestBuilder<'a> {
336368
where
337369
I: Iterator<Item = (K, V)>,
338370
K: Into<Cow<'a, str>>,
339-
V: Into<Cow<'a, str>>,
371+
V: Into<LabelsOverridden<'a>>,
340372
{
341373
self.labels_overridden
342374
.get_or_insert(None)
@@ -349,7 +381,7 @@ impl<'a> RequestBuilder<'a> {
349381
where
350382
I: Iterator<Item = (K, V)>,
351383
K: Into<Cow<'a, str>>,
352-
V: Into<Cow<'a, str>>,
384+
V: Into<LabelsSkipped<'a>>,
353385
{
354386
self.labels_skipped
355387
.get_or_insert(None)

openstack_sdk/src/api/container_infrastructure_management/v1/cluster/nodegroup/create.rs

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,38 @@ use serde::Serialize;
3434
use std::borrow::Cow;
3535
use std::collections::BTreeMap;
3636

37+
#[derive(Debug, Deserialize, Clone, Serialize)]
38+
#[serde(untagged)]
39+
pub enum Labels<'a> {
40+
F1(bool),
41+
F2(i32),
42+
F3(Cow<'a, str>),
43+
}
44+
45+
#[derive(Debug, Deserialize, Clone, Serialize)]
46+
#[serde(untagged)]
47+
pub enum LabelsAdded<'a> {
48+
F1(bool),
49+
F2(i32),
50+
F3(Cow<'a, str>),
51+
}
52+
53+
#[derive(Debug, Deserialize, Clone, Serialize)]
54+
#[serde(untagged)]
55+
pub enum LabelsOverridden<'a> {
56+
F1(bool),
57+
F2(i32),
58+
F3(Cow<'a, str>),
59+
}
60+
61+
#[derive(Debug, Deserialize, Clone, Serialize)]
62+
#[serde(untagged)]
63+
pub enum LabelsSkipped<'a> {
64+
F1(bool),
65+
F2(i32),
66+
F3(Cow<'a, str>),
67+
}
68+
3769
/// A link representation.
3870
#[derive(Builder, Debug, Deserialize, Clone, Serialize)]
3971
#[builder(setter(strip_option))]
@@ -124,16 +156,16 @@ pub struct Request<'a> {
124156
pub(crate) is_default: Option<Cow<'a, str>>,
125157

126158
#[builder(default, private, setter(into, name = "_labels"))]
127-
pub(crate) labels: Option<BTreeMap<Cow<'a, str>, Cow<'a, str>>>,
159+
pub(crate) labels: Option<BTreeMap<Cow<'a, str>, Labels<'a>>>,
128160

129161
#[builder(default, private, setter(into, name = "_labels_added"))]
130-
pub(crate) labels_added: Option<BTreeMap<Cow<'a, str>, Cow<'a, str>>>,
162+
pub(crate) labels_added: Option<BTreeMap<Cow<'a, str>, LabelsAdded<'a>>>,
131163

132164
#[builder(default, private, setter(into, name = "_labels_overridden"))]
133-
pub(crate) labels_overridden: Option<BTreeMap<Cow<'a, str>, Cow<'a, str>>>,
165+
pub(crate) labels_overridden: Option<BTreeMap<Cow<'a, str>, LabelsOverridden<'a>>>,
134166

135167
#[builder(default, private, setter(into, name = "_labels_skipped"))]
136-
pub(crate) labels_skipped: Option<BTreeMap<Cow<'a, str>, Cow<'a, str>>>,
168+
pub(crate) labels_skipped: Option<BTreeMap<Cow<'a, str>, LabelsSkipped<'a>>>,
137169

138170
#[builder(default, setter(into))]
139171
pub(crate) links: Option<Vec<Links<'a>>>,
@@ -195,7 +227,7 @@ impl<'a> RequestBuilder<'a> {
195227
where
196228
I: Iterator<Item = (K, V)>,
197229
K: Into<Cow<'a, str>>,
198-
V: Into<Cow<'a, str>>,
230+
V: Into<Labels<'a>>,
199231
{
200232
self.labels
201233
.get_or_insert(None)
@@ -208,7 +240,7 @@ impl<'a> RequestBuilder<'a> {
208240
where
209241
I: Iterator<Item = (K, V)>,
210242
K: Into<Cow<'a, str>>,
211-
V: Into<Cow<'a, str>>,
243+
V: Into<LabelsAdded<'a>>,
212244
{
213245
self.labels_added
214246
.get_or_insert(None)
@@ -221,7 +253,7 @@ impl<'a> RequestBuilder<'a> {
221253
where
222254
I: Iterator<Item = (K, V)>,
223255
K: Into<Cow<'a, str>>,
224-
V: Into<Cow<'a, str>>,
256+
V: Into<LabelsOverridden<'a>>,
225257
{
226258
self.labels_overridden
227259
.get_or_insert(None)
@@ -234,7 +266,7 @@ impl<'a> RequestBuilder<'a> {
234266
where
235267
I: Iterator<Item = (K, V)>,
236268
K: Into<Cow<'a, str>>,
237-
V: Into<Cow<'a, str>>,
269+
V: Into<LabelsSkipped<'a>>,
238270
{
239271
self.labels_skipped
240272
.get_or_insert(None)

0 commit comments

Comments
 (0)