Skip to content

Commit aa610c4

Browse files
authored
fix(router): fix recursion bug in straight through algorithm (#1080)
1 parent 5c5c3ef commit aa610c4

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

Cargo.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/api_models/src/admin.rs

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,25 +275,41 @@ pub enum StraightThroughAlgorithm {
275275
Single(api_enums::RoutableConnectors),
276276
}
277277

278+
#[derive(Clone, Debug, Deserialize, Serialize)]
279+
#[serde(tag = "type", content = "data", rename_all = "snake_case")]
280+
pub enum StraightThroughAlgorithmInner {
281+
Single(api_enums::RoutableConnectors),
282+
}
283+
278284
#[derive(Debug, Clone, Serialize, Deserialize)]
279285
#[serde(untagged)]
280286
pub enum StraightThroughAlgorithmSerde {
281-
Direct(StraightThroughAlgorithm),
282-
Nested { algorithm: StraightThroughAlgorithm },
287+
Direct(StraightThroughAlgorithmInner),
288+
Nested {
289+
algorithm: StraightThroughAlgorithmInner,
290+
},
283291
}
284292

285293
impl From<StraightThroughAlgorithmSerde> for StraightThroughAlgorithm {
286294
fn from(value: StraightThroughAlgorithmSerde) -> Self {
287-
match value {
295+
let inner = match value {
288296
StraightThroughAlgorithmSerde::Direct(algorithm) => algorithm,
289297
StraightThroughAlgorithmSerde::Nested { algorithm } => algorithm,
298+
};
299+
300+
match inner {
301+
StraightThroughAlgorithmInner::Single(conn) => Self::Single(conn),
290302
}
291303
}
292304
}
293305

294306
impl From<StraightThroughAlgorithm> for StraightThroughAlgorithmSerde {
295307
fn from(value: StraightThroughAlgorithm) -> Self {
296-
Self::Nested { algorithm: value }
308+
let inner = match value {
309+
StraightThroughAlgorithm::Single(conn) => StraightThroughAlgorithmInner::Single(conn),
310+
};
311+
312+
Self::Nested { algorithm: inner }
297313
}
298314
}
299315

0 commit comments

Comments
 (0)