diff --git a/src/metagen/fixtures/client_rs/Cargo.toml b/src/metagen/fixtures/client_rs/Cargo.toml index c1b563fa7d..e7957420ab 100644 --- a/src/metagen/fixtures/client_rs/Cargo.toml +++ b/src/metagen/fixtures/client_rs/Cargo.toml @@ -3,10 +3,15 @@ package.edition = "2021" package.version = "0.0.1" [dependencies] -serde = { version = "1.0.203", features = ["derive"] } -serde_json = "1.0.117" +serde = { version = "1.0.210", features = ["derive"] } +serde_json = "1.0.128" +reqwest = { version = "0.12", features = ["blocking","json", "stream", "multipart"] } +mime_guess = "2.0" +futures = "0.3" +tokio-util = { version = "0.7", features = ["compat", "io"] } +derive_more = { version = "1.0", features = ["debug"] } +lazy_static = "1.5" tokio = { version = "1", features = ["rt-multi-thread"] } -reqwest = { version = "0.12", features = ["blocking","json"] } [workspace] resolver = "2" diff --git a/src/metagen/fixtures/tg.ts b/src/metagen/fixtures/tg.ts index 12fbe189ba..f6eff20dda 100644 --- a/src/metagen/fixtures/tg.ts +++ b/src/metagen/fixtures/tg.ts @@ -10,7 +10,8 @@ typegraph({ int: t.integer(), float: t.float(), boolean: t.boolean(), - file: t.file(), + // FIXME file upload for FDK + // file: t.file(), opt: t.optional(t.string()), either: t.either([ t.struct({ a: t.string() }), diff --git a/src/metagen/src/client_rs/static/client.rs b/src/metagen/src/client_rs/static/client.rs index 698fe814ba..aac816d734 100644 --- a/src/metagen/src/client_rs/static/client.rs +++ b/src/metagen/src/client_rs/static/client.rs @@ -255,11 +255,7 @@ impl std::error::Error for SelectionError {} pub struct TypePath(&'static [&'static str]); fn path_segment_as_prop(segment: &str) -> Option<&str> { - if segment.starts_with('.') { - Some(&segment[1..]) - } else { - None - } + segment.strip_prefix('.') } #[derive(Debug, Clone)] @@ -312,7 +308,7 @@ impl TryFrom for File { fn try_from(file_id: FileId) -> Result { let mut guard = FILE_STORE.lock().map_err(|_| "file store lock poisoned")?; - let file = guard.remove(&file_id).ok_or_else(|| "file not found")?; + let file = guard.remove(&file_id).ok_or("file not found")?; if file.file_name.is_none() { Ok(file.file_name(file_id.0.to_string())) } else { @@ -1761,7 +1757,7 @@ pub mod graphql { // TODO rename files - if files.len() > 0 { + if !files.is_empty() { // multipart let mut form = Form::new(); @@ -1828,7 +1824,7 @@ pub mod graphql { "variables": variables }); - if files.len() > 0 { + if !files.is_empty() { // multipart let mut form = Form::new(); diff --git a/src/metagen/src/tests/mod.rs b/src/metagen/src/tests/mod.rs index b33d798cb9..e515735433 100644 --- a/src/metagen/src/tests/mod.rs +++ b/src/metagen/src/tests/mod.rs @@ -64,6 +64,7 @@ async fn load_fdk_template( Ok(FdkTemplate { entries }) } +#[derive(Debug)] pub struct BuildArgs { pub path: PathBuf, } diff --git a/tools/tasks/test.ts b/tools/tasks/test.ts index 649c9e4fc3..4942b10923 100644 --- a/tools/tasks/test.ts +++ b/tools/tasks/test.ts @@ -31,7 +31,8 @@ export default { --exclude typegate --exclude typegate_engine --exclude typegraph_core - --exclude metagen_fdk_rust_static`; + --exclude metagen_fdk_rust_static + --exclude client_rs_static`; // typegraph_core tests need to be run separately // without --tests, the --doc is causing a link error "syntax error in VERSION script" await $`cargo test --locked --package typegraph_core --tests`;