Skip to content

Commit b58d84f

Browse files
committed
Fix: UIGF: uid is oneOf(string, integer)
1 parent 1d298c6 commit b58d84f

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

  • src/api/gi/uigf_wishes_import

src/api/gi/uigf_wishes_import/mod.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,22 @@ pub fn configure(cfg: &mut web::ServiceConfig) {
2525
cfg.service(post_uigf_warps_import);
2626
}
2727

28+
#[derive(serde::Deserialize)]
29+
#[serde(untagged)]
30+
enum StringOrInt {
31+
String(String),
32+
Int(i32),
33+
}
34+
35+
impl StringOrInt {
36+
fn parse(self) -> Result<i32, std::num::ParseIntError> {
37+
match self {
38+
StringOrInt::String(s) => s.parse(),
39+
StringOrInt::Int(i) => Ok(i),
40+
}
41+
}
42+
}
43+
2844
#[derive(serde::Deserialize, utoipa::ToSchema)]
2945
struct UigfWishesImportParams {
3046
data: String,
@@ -37,7 +53,7 @@ struct Uigf {
3753

3854
#[derive(serde::Deserialize)]
3955
struct Hk4e {
40-
uid: String,
56+
uid: StringOrInt,
4157
timezone: i32,
4258
list: Vec<Pull>,
4359
}

0 commit comments

Comments
 (0)