From 767048e4d67edf5846dbfbe8b23cadba80ea8106 Mon Sep 17 00:00:00 2001 From: michael-0acf4 Date: Tue, 7 Jan 2025 22:38:00 +0300 Subject: [PATCH 1/4] fix: bad name on shared types --- .../core/src/utils/postprocess/naming.rs | 115 ++++++++++++++++-- 1 file changed, 106 insertions(+), 9 deletions(-) diff --git a/src/typegraph/core/src/utils/postprocess/naming.rs b/src/typegraph/core/src/utils/postprocess/naming.rs index 1a062eb00..272abc0ff 100644 --- a/src/typegraph/core/src/utils/postprocess/naming.rs +++ b/src/typegraph/core/src/utils/postprocess/naming.rs @@ -10,6 +10,7 @@ use common::typegraph::{ visitor::{Edge, PathSegment}, StringFormat, TypeNode, Typegraph, }; +use indexmap::IndexSet; use crate::errors::TgError; @@ -25,10 +26,6 @@ impl super::PostProcessor for NamingProcessor { tg, user_named: self.user_named, }; - let mut acc = VisitCollector { - named_types: Default::default(), - path: vec![], - }; let TypeNode::Object { data: root_data, .. @@ -36,6 +33,19 @@ impl super::PostProcessor for NamingProcessor { else { panic!("first item must be root object") }; + + let mut ref_counters = TypeRefCount { + counts: Default::default(), + }; + for (_, &ty_id) in &root_data.properties { + collect_ref_info(&cx, &mut ref_counters, ty_id)?; + } + + let mut acc = VisitCollector { + named_types: Default::default(), + path: vec![], + counts: ref_counters.counts, + }; for (key, &ty_id) in &root_data.properties { acc.path.push(( PathSegment { @@ -61,9 +71,35 @@ struct VisitContext<'a> { } struct VisitCollector { named_types: HashMap>, + counts: HashMap>, path: Vec<(PathSegment, Rc)>, } +struct TypeRefCount { + pub counts: HashMap>, +} + +impl TypeRefCount { + pub fn new_hit(&mut self, id: u32, referer: u32) { + self.counts + .entry(id) + .and_modify(|counter| { + counter.insert(referer); + }) + .or_insert(IndexSet::from([referer])); + } +} + +impl VisitCollector { + pub fn has_more_than_one_referer(&self, id: u32) -> bool { + if let Some(referers) = self.counts.get(&id) { + return referers.len() > 1; + } + + false + } +} + fn visit_type(cx: &VisitContext, acc: &mut VisitCollector, id: u32) -> anyhow::Result> { if let Some(name) = acc.named_types.get(&id) { return Ok(name.clone()); @@ -215,14 +251,75 @@ fn visit_type(cx: &VisitContext, acc: &mut VisitCollector, id: u32) -> anyhow::R }; acc.named_types.insert(id, name.clone()); + Ok(name) } +fn collect_ref_info(cx: &VisitContext, acc: &mut TypeRefCount, id: u32) -> anyhow::Result<()> { + let node = &cx.tg.types[id as usize]; + match node { + TypeNode::Boolean { .. } + | TypeNode::Float { .. } + | TypeNode::Integer { .. } + | TypeNode::String { .. } + | TypeNode::File { .. } + | TypeNode::Any { .. } => { + // base case + } + TypeNode::Optional { data, .. } => { + acc.new_hit(data.item, id); + collect_ref_info(cx, acc, data.item)?; + } + TypeNode::Object { data, .. } => { + for (_, key_id) in &data.properties { + acc.new_hit(*key_id, id); + collect_ref_info(cx, acc, *key_id)?; + } + } + TypeNode::Function { data, .. } => { + acc.new_hit(data.input, id); + acc.new_hit(data.output, id); + + collect_ref_info(cx, acc, data.input)?; + collect_ref_info(cx, acc, data.output)?; + } + TypeNode::List { data, .. } => { + acc.new_hit(data.items, id); + collect_ref_info(cx, acc, data.items)?; + } + TypeNode::Union { data, .. } => { + for variant in &data.any_of { + acc.new_hit(*variant, id); + collect_ref_info(cx, acc, *variant)?; + } + } + TypeNode::Either { data, .. } => { + for variant in &data.one_of { + acc.new_hit(*variant, id); + collect_ref_info(cx, acc, *variant)?; + } + } + }; + + Ok(()) +} + fn gen_name(cx: &VisitContext, acc: &mut VisitCollector, id: u32, ty_name: &str) -> Rc { + let node = &cx.tg.types[id as usize]; let name: Rc = if cx.user_named.contains(&id) { - let node = &cx.tg.types[id as usize]; node.base().title.clone().into() + } else if node.is_scalar() { + format!("scalar_{ty_name}").into() } else { + let use_if_ok = |default: String| { + if acc.has_more_than_one_referer(id) { + // Cannot be opinionated on the prefix path if shared (confusing) + format!("{ty_name}_shared_t{id}") + } else { + default + } + }; + let title; let mut last = acc.path.len(); loop { @@ -232,11 +329,11 @@ fn gen_name(cx: &VisitContext, acc: &mut VisitCollector, id: u32, ty_name: &str) // we don't include optional and list nodes in // generated names (useless but also, they might be placeholders) Edge::OptionalItem | Edge::ArrayItem => continue, - Edge::FunctionInput => format!("{last_name}_input"), - Edge::FunctionOutput => format!("{last_name}_output"), - Edge::ObjectProp(key) => format!("{last_name}_{key}_{ty_name}"), + Edge::FunctionInput => use_if_ok(format!("{last_name}_input")), + Edge::FunctionOutput => use_if_ok(format!("{last_name}_output")), + Edge::ObjectProp(key) => use_if_ok(format!("{last_name}_{key}_{ty_name}")), Edge::EitherVariant(idx) | Edge::UnionVariant(idx) => { - format!("{last_name}_t{idx}_{ty_name}") + use_if_ok(format!("{last_name}_t{idx}_{ty_name}")) } }; break; From 18bc3cc8586f92b5a8ac25bb6ee9444f2486b9f0 Mon Sep 17 00:00:00 2001 From: michael-0acf4 Date: Tue, 7 Jan 2025 23:12:44 +0300 Subject: [PATCH 2/4] fix: typo and address comment --- .../core/src/utils/postprocess/naming.rs | 43 ++++++++++++------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/src/typegraph/core/src/utils/postprocess/naming.rs b/src/typegraph/core/src/utils/postprocess/naming.rs index 272abc0ff..f07f7380c 100644 --- a/src/typegraph/core/src/utils/postprocess/naming.rs +++ b/src/typegraph/core/src/utils/postprocess/naming.rs @@ -38,7 +38,7 @@ impl super::PostProcessor for NamingProcessor { counts: Default::default(), }; for (_, &ty_id) in &root_data.properties { - collect_ref_info(&cx, &mut ref_counters, ty_id)?; + collect_ref_info(&cx, &mut ref_counters, ty_id, &mut HashSet::new())?; } let mut acc = VisitCollector { @@ -80,20 +80,20 @@ struct TypeRefCount { } impl TypeRefCount { - pub fn new_hit(&mut self, id: u32, referer: u32) { + pub fn new_hit(&mut self, id: u32, referrer: u32) { self.counts .entry(id) .and_modify(|counter| { - counter.insert(referer); + counter.insert(referrer); }) - .or_insert(IndexSet::from([referer])); + .or_insert(IndexSet::from([referrer])); } } impl VisitCollector { - pub fn has_more_than_one_referer(&self, id: u32) -> bool { - if let Some(referers) = self.counts.get(&id) { - return referers.len() > 1; + pub fn has_more_than_one_referrer(&self, id: u32) -> bool { + if let Some(referrers) = self.counts.get(&id) { + return referrers.len() > 1; } false @@ -255,7 +255,16 @@ fn visit_type(cx: &VisitContext, acc: &mut VisitCollector, id: u32) -> anyhow::R Ok(name) } -fn collect_ref_info(cx: &VisitContext, acc: &mut TypeRefCount, id: u32) -> anyhow::Result<()> { +fn collect_ref_info( + cx: &VisitContext, + acc: &mut TypeRefCount, + id: u32, + visited: &mut HashSet, +) -> anyhow::Result<()> { + if !visited.insert(id) { + return Ok(()); + } + let node = &cx.tg.types[id as usize]; match node { TypeNode::Boolean { .. } @@ -268,39 +277,41 @@ fn collect_ref_info(cx: &VisitContext, acc: &mut TypeRefCount, id: u32) -> anyho } TypeNode::Optional { data, .. } => { acc.new_hit(data.item, id); - collect_ref_info(cx, acc, data.item)?; + collect_ref_info(cx, acc, data.item, visited)?; } TypeNode::Object { data, .. } => { for (_, key_id) in &data.properties { acc.new_hit(*key_id, id); - collect_ref_info(cx, acc, *key_id)?; + collect_ref_info(cx, acc, *key_id, visited)?; } } TypeNode::Function { data, .. } => { acc.new_hit(data.input, id); acc.new_hit(data.output, id); - collect_ref_info(cx, acc, data.input)?; - collect_ref_info(cx, acc, data.output)?; + collect_ref_info(cx, acc, data.input, visited)?; + collect_ref_info(cx, acc, data.output, visited)?; } TypeNode::List { data, .. } => { acc.new_hit(data.items, id); - collect_ref_info(cx, acc, data.items)?; + collect_ref_info(cx, acc, data.items, visited)?; } TypeNode::Union { data, .. } => { for variant in &data.any_of { acc.new_hit(*variant, id); - collect_ref_info(cx, acc, *variant)?; + collect_ref_info(cx, acc, *variant, visited)?; } } TypeNode::Either { data, .. } => { for variant in &data.one_of { acc.new_hit(*variant, id); - collect_ref_info(cx, acc, *variant)?; + collect_ref_info(cx, acc, *variant, visited)?; } } }; + visited.remove(&id); + Ok(()) } @@ -312,7 +323,7 @@ fn gen_name(cx: &VisitContext, acc: &mut VisitCollector, id: u32, ty_name: &str) format!("scalar_{ty_name}").into() } else { let use_if_ok = |default: String| { - if acc.has_more_than_one_referer(id) { + if acc.has_more_than_one_referrer(id) { // Cannot be opinionated on the prefix path if shared (confusing) format!("{ty_name}_shared_t{id}") } else { From 784e8e14ce49078ef70c680395c00ce53ee660d4 Mon Sep 17 00:00:00 2001 From: michael-0acf4 Date: Wed, 8 Jan 2025 18:11:39 +0300 Subject: [PATCH 3/4] fix: update snapshots --- examples/typegraphs/metagen/rs/fdk.rs | 16 +- .../src/typegraphs/introspection.json | 8 +- src/typegate/src/typegraphs/typegate.json | 36 +-- ...core__tests__successful_serialization.snap | 10 +- .../core/src/utils/postprocess/naming.rs | 51 +++-- .../__snapshots__/typegraph_test.ts.snap | 60 ++--- .../__snapshots__/metagen_test.ts.snap | 208 +++++++++--------- tests/metagen/typegraphs/identities/rs/fdk.rs | 78 +++---- tests/metagen/typegraphs/identities/ts/fdk.ts | 78 +++---- tests/metagen/typegraphs/sample/py/client.py | 70 +++--- .../typegraphs/sample/py_upload/client.py | 46 ++-- tests/metagen/typegraphs/sample/rs/client.rs | 68 +++--- tests/metagen/typegraphs/sample/rs/main.rs | 12 +- .../typegraphs/sample/rs_upload/client.rs | 48 ++-- tests/metagen/typegraphs/sample/ts/client.ts | 68 +++--- .../typegraphs/sample/ts_upload/client.ts | 40 ++-- .../__snapshots__/graphql_test.ts.snap | 18 +- .../grpc/__snapshots__/grpc_test.ts.snap | 8 +- .../runtimes/kv/__snapshots__/kv_test.ts.snap | 24 +- .../runtimes/s3/__snapshots__/s3_test.ts.snap | 14 +- .../__snapshots__/temporal_test.ts.snap | 22 +- .../typegate_prisma_test.ts.snap | 34 +-- .../typegate_runtime_test.ts.snap | 38 ++-- tests/runtimes/wasm_reflected/rust/Cargo.lock | 2 +- tests/runtimes/wasm_wire/rust/fdk.rs | 48 ++-- 25 files changed, 557 insertions(+), 548 deletions(-) diff --git a/examples/typegraphs/metagen/rs/fdk.rs b/examples/typegraphs/metagen/rs/fdk.rs index a67d003e4..2d575f711 100644 --- a/examples/typegraphs/metagen/rs/fdk.rs +++ b/examples/typegraphs/metagen/rs/fdk.rs @@ -109,7 +109,7 @@ impl Router { } pub fn init(&self, args: InitArgs) -> Result { - static MT_VERSION: &str = "0.5.0-rc.8"; + static MT_VERSION: &str = "0.5.0-rc.9"; if args.metatype_version != MT_VERSION { return Err(InitError::VersionMismatch(MT_VERSION.into())); } @@ -219,17 +219,17 @@ macro_rules! init_mat { // gen-static-end use types::*; pub mod types { - pub type Idv3TitleString = String; - pub type Idv3ReleaseTimeStringDatetime = String; - pub type Idv3Mp3UrlStringUri = String; + pub type ScalarString1 = String; + pub type ScalarStringDatetime1 = String; + pub type ScalarStringUri1 = String; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct Idv3 { - pub title: Idv3TitleString, - pub artist: Idv3TitleString, + pub title: ScalarString1, + pub artist: ScalarString1, #[serde(rename = "releaseTime")] - pub release_time: Idv3ReleaseTimeStringDatetime, + pub release_time: ScalarStringDatetime1, #[serde(rename = "mp3Url")] - pub mp3_url: Idv3Mp3UrlStringUri, + pub mp3_url: ScalarStringUri1, } } pub mod stubs { diff --git a/src/typegate/src/typegraphs/introspection.json b/src/typegate/src/typegraphs/introspection.json index 66947140e..eee6c5491 100644 --- a/src/typegate/src/typegraphs/introspection.json +++ b/src/typegate/src/typegraphs/introspection.json @@ -45,7 +45,7 @@ }, { "type": "string", - "title": "root___type_fn_input_name_string" + "title": "scalar_string_1" }, { "type": "optional", @@ -99,7 +99,7 @@ }, { "type": "optional", - "title": "type_name_root___type_fn_input_name_string_optional", + "title": "type_name_scalar_string_1_optional", "item": 3, "default_value": null }, @@ -127,13 +127,13 @@ }, { "type": "optional", - "title": "type_fields_fn_input_includeDeprecated_type_fields_fn_input_includeDeprecated_boolean_optional", + "title": "type_fields_fn_input_includeDeprecated_scalar_boolean_1_optional", "item": 11, "default_value": null }, { "type": "boolean", - "title": "type_fields_fn_input_includeDeprecated_boolean" + "title": "scalar_boolean_1" }, { "type": "optional", diff --git a/src/typegate/src/typegraphs/typegate.json b/src/typegate/src/typegraphs/typegate.json index 828df86a1..aab573549 100644 --- a/src/typegate/src/typegraphs/typegate.json +++ b/src/typegate/src/typegraphs/typegate.json @@ -83,7 +83,7 @@ }, { "type": "object", - "title": "root_typegraphs_fn_input", + "title": "scalar_struct_shared_1", "properties": {}, "id": [], "required": [] @@ -109,11 +109,11 @@ }, { "type": "string", - "title": "Typegraph_name_string" + "title": "scalar_string_1" }, { "type": "string", - "title": "Typegraph_url_string_uri", + "title": "scalar_string_uri_1", "format": "uri" }, { @@ -198,7 +198,7 @@ }, { "type": "string", - "title": "root_addTypegraph_fn_input_fromString_string_json", + "title": "scalar_string_json_1", "format": "json" }, { @@ -240,7 +240,7 @@ }, { "type": "string", - "title": "root_addTypegraph_fn_output_messages_struct_type_string_enum", + "title": "scalar_string_enum_1", "enum": [ "\"info\"", "\"warning\"", @@ -268,7 +268,7 @@ }, { "type": "optional", - "title": "root_addTypegraph_fn_output_failure_root_addTypegraph_fn_input_fromString_string_json_optional", + "title": "root_addTypegraph_fn_output_failure_scalar_string_json_1_optional", "item": 14, "default_value": null }, @@ -296,12 +296,12 @@ }, { "type": "list", - "title": "root_removeTypegraphs_fn_input_names_Typegraph_name_string_list", + "title": "scalar_scalar_string_1_list_shared_1", "items": 5 }, { "type": "boolean", - "title": "root_removeTypegraphs_fn_output" + "title": "scalar_boolean_1" }, { "type": "function", @@ -333,7 +333,7 @@ }, { "type": "list", - "title": "root_argInfoByPath_fn_input_argPaths_root_removeTypegraphs_fn_input_names_Typegraph_name_string_list_list", + "title": "root_argInfoByPath_fn_input_argPaths_scalar_scalar_string_1_list_shared_1_list", "items": 24 }, { @@ -369,18 +369,18 @@ }, { "type": "optional", - "title": "TypeInfo_enum_TypeInfo_enum_root_addTypegraph_fn_input_fromString_string_json_list_optional", + "title": "TypeInfo_enum_TypeInfo_enum_scalar_string_json_1_list_optional", "item": 32, "default_value": null }, { "type": "list", - "title": "TypeInfo_enum_root_addTypegraph_fn_input_fromString_string_json_list", + "title": "TypeInfo_enum_scalar_string_json_1_list", "items": 14 }, { "type": "optional", - "title": "TypeInfo_format_Typegraph_name_string_optional", + "title": "TypeInfo_format_scalar_string_1_optional", "item": 5, "default_value": null }, @@ -440,7 +440,7 @@ }, { "type": "object", - "title": "root_findAvailableOperations_fn_input", + "title": "scalar_struct_shared_2", "properties": { "typegraph": 5 }, @@ -477,7 +477,7 @@ }, { "type": "string", - "title": "OperationInfo_type_string_enum", + "title": "scalar_string_enum_2", "enum": [ "\"query\"", "\"mutation\"" @@ -596,7 +596,7 @@ }, { "type": "object", - "title": "root_execRawPrismaRead_fn_input", + "title": "scalar_struct_shared_3", "properties": { "typegraph": 5, "runtime": 5, @@ -697,13 +697,13 @@ }, { "type": "optional", - "title": "PrismaBatchQuery_transaction_struct_isolationLevel_PrismaBatchQuery_transaction_struct_isolationLevel_string_enum_optional", + "title": "PrismaBatchQuery_transaction_struct_isolationLevel_scalar_string_enum_3_optional", "item": 63, "default_value": null }, { "type": "string", - "title": "PrismaBatchQuery_transaction_struct_isolationLevel_string_enum", + "title": "scalar_string_enum_3", "enum": [ "\"read uncommitted\"", "\"readuncommitted\"", @@ -777,7 +777,7 @@ }, { "type": "integer", - "title": "root_queryPrismaModel_fn_input_offset_integer" + "title": "scalar_integer_1" }, { "type": "object", diff --git a/src/typegraph/core/src/snapshots/typegraph_core__tests__successful_serialization.snap b/src/typegraph/core/src/snapshots/typegraph_core__tests__successful_serialization.snap index 29f6ea430..472071a44 100644 --- a/src/typegraph/core/src/snapshots/typegraph_core__tests__successful_serialization.snap +++ b/src/typegraph/core/src/snapshots/typegraph_core__tests__successful_serialization.snap @@ -43,28 +43,28 @@ expression: typegraph.0 }, { "type": "integer", - "title": "root_one_fn_input_one_integer" + "title": "scalar_integer_1" }, { "type": "integer", - "title": "root_one_fn_input_two_integer", + "title": "scalar_integer_2", "minimum": 12, "maximum": 44 }, { "type": "optional", - "title": "root_one_fn_input_three_root_one_fn_input_three_root_one_fn_input_three_float_list_optional", + "title": "root_one_fn_input_three_root_one_fn_input_three_scalar_float_1_list_optional", "item": 6, "default_value": null }, { "type": "list", - "title": "root_one_fn_input_three_root_one_fn_input_three_float_list", + "title": "root_one_fn_input_three_scalar_float_1_list", "items": 7 }, { "type": "float", - "title": "root_one_fn_input_three_float" + "title": "scalar_float_1" } ], "materializers": [ diff --git a/src/typegraph/core/src/utils/postprocess/naming.rs b/src/typegraph/core/src/utils/postprocess/naming.rs index f07f7380c..07295b279 100644 --- a/src/typegraph/core/src/utils/postprocess/naming.rs +++ b/src/typegraph/core/src/utils/postprocess/naming.rs @@ -44,7 +44,9 @@ impl super::PostProcessor for NamingProcessor { let mut acc = VisitCollector { named_types: Default::default(), path: vec![], + // ref related counts: ref_counters.counts, + name_occurences: Default::default(), }; for (key, &ty_id) in &root_data.properties { acc.path.push(( @@ -71,8 +73,10 @@ struct VisitContext<'a> { } struct VisitCollector { named_types: HashMap>, - counts: HashMap>, path: Vec<(PathSegment, Rc)>, + // ref related + counts: HashMap>, + name_occurences: HashMap, } struct TypeRefCount { @@ -98,6 +102,19 @@ impl VisitCollector { false } + + pub fn next_name(&mut self, name: String) -> String { + // Hopefully more stable than ids on snapshots + format!( + "scalar_{name}_{}", + self.name_occurences + .entry(name.clone()) + .and_modify(|counter| { + *counter += 1; + }) + .or_insert(1) + ) + } } fn visit_type(cx: &VisitContext, acc: &mut VisitCollector, id: u32) -> anyhow::Result> { @@ -261,10 +278,12 @@ fn collect_ref_info( id: u32, visited: &mut HashSet, ) -> anyhow::Result<()> { - if !visited.insert(id) { + if cx.user_named.contains(&id) || visited.contains(&id) { return Ok(()); } + visited.insert(id); + let node = &cx.tg.types[id as usize]; match node { TypeNode::Boolean { .. } @@ -320,16 +339,18 @@ fn gen_name(cx: &VisitContext, acc: &mut VisitCollector, id: u32, ty_name: &str) let name: Rc = if cx.user_named.contains(&id) { node.base().title.clone().into() } else if node.is_scalar() { - format!("scalar_{ty_name}").into() + acc.next_name(ty_name.to_string()).into() } else { - let use_if_ok = |default: String| { - if acc.has_more_than_one_referrer(id) { - // Cannot be opinionated on the prefix path if shared (confusing) - format!("{ty_name}_shared_t{id}") - } else { - default - } - }; + macro_rules! use_if_ok { + ($default:expr) => { + if acc.has_more_than_one_referrer(id) { + // Cannot be opinionated on the prefix path if shared (confusing) + acc.next_name(format!("{ty_name}_shared")).into() + } else { + $default + } + }; + } let title; let mut last = acc.path.len(); @@ -340,11 +361,11 @@ fn gen_name(cx: &VisitContext, acc: &mut VisitCollector, id: u32, ty_name: &str) // we don't include optional and list nodes in // generated names (useless but also, they might be placeholders) Edge::OptionalItem | Edge::ArrayItem => continue, - Edge::FunctionInput => use_if_ok(format!("{last_name}_input")), - Edge::FunctionOutput => use_if_ok(format!("{last_name}_output")), - Edge::ObjectProp(key) => use_if_ok(format!("{last_name}_{key}_{ty_name}")), + Edge::FunctionInput => use_if_ok!(format!("{last_name}_input")), + Edge::FunctionOutput => use_if_ok!(format!("{last_name}_output")), + Edge::ObjectProp(key) => use_if_ok!(format!("{last_name}_{key}_{ty_name}")), Edge::EitherVariant(idx) | Edge::UnionVariant(idx) => { - use_if_ok(format!("{last_name}_t{idx}_{ty_name}")) + use_if_ok!(format!("{last_name}_t{idx}_{ty_name}")) } }; break; diff --git a/tests/e2e/typegraph/__snapshots__/typegraph_test.ts.snap b/tests/e2e/typegraph/__snapshots__/typegraph_test.ts.snap index 4f0039f62..42ff6dc34 100644 --- a/tests/e2e/typegraph/__snapshots__/typegraph_test.ts.snap +++ b/tests/e2e/typegraph/__snapshots__/typegraph_test.ts.snap @@ -60,17 +60,17 @@ snapshot[`typegraphs creation 1`] = ` }, { "type": "string", - "title": "ComplexType_a_string_string" + "title": "scalar_string_1" }, { "type": "float", - "title": "ComplexType_a_float_float", + "title": "scalar_float_1", "minimum": 1.0, "multipleOf": 2.0 }, { "type": "string", - "title": "ComplexType_an_enum_string_enum", + "title": "scalar_string_enum_1", "enum": [ "\\\\"one\\\\"", "\\\\"two\\\\"" @@ -78,7 +78,7 @@ snapshot[`typegraphs creation 1`] = ` }, { "type": "integer", - "title": "ComplexType_an_integer_enum_integer_enum", + "title": "scalar_integer_enum_1", "enum": [ "1", "2" @@ -86,7 +86,7 @@ snapshot[`typegraphs creation 1`] = ` }, { "type": "float", - "title": "ComplexType_a_float_enum_float", + "title": "scalar_float_2", "enum": [ "1.5", "2.5" @@ -106,7 +106,7 @@ snapshot[`typegraphs creation 1`] = ` }, { "type": "float", - "title": "ComplexType_a_struct_struct_value_float" + "title": "scalar_float_3" }, { "type": "optional", @@ -129,7 +129,7 @@ snapshot[`typegraphs creation 1`] = ` }, { "type": "integer", - "title": "ComplexType_nested_either_t1_integer" + "title": "scalar_integer_1" }, { "type": "object", @@ -159,12 +159,12 @@ snapshot[`typegraphs creation 1`] = ` }, { "type": "string", - "title": "ComplexType_an_email_string_email", + "title": "scalar_string_email_1", "format": "email" }, { "type": "boolean", - "title": "root_test_fn_output" + "title": "scalar_boolean_1" } ], "materializers": [ @@ -302,7 +302,7 @@ snapshot[`typegraphs creation 2`] = ` }, { "type": "object", - "title": "root_add_fn_input", + "title": "scalar_struct_shared_1", "properties": { "first": 3, "second": 3 @@ -316,7 +316,7 @@ snapshot[`typegraphs creation 2`] = ` }, { "type": "float", - "title": "root_add_fn_input_first_float" + "title": "scalar_float_1" }, { "type": "function", @@ -454,7 +454,7 @@ snapshot[`typegraphs creation 3`] = ` }, { "type": "object", - "title": "root_one_fn_input", + "title": "scalar_struct_shared_1", "properties": { "a": 3, "b": 4 @@ -468,16 +468,16 @@ snapshot[`typegraphs creation 3`] = ` }, { "type": "integer", - "title": "root_one_fn_input_a_integer" + "title": "scalar_integer_1" }, { "type": "integer", - "title": "root_one_fn_input_b_integer", + "title": "scalar_integer_2", "minimum": 12 }, { "type": "integer", - "title": "root_one_fn_output", + "title": "scalar_integer_3", "minimum": 12, "maximum": 43 }, @@ -729,17 +729,17 @@ snapshot[`typegraphs creation 4`] = ` }, { "type": "string", - "title": "ComplexType_a_string_string" + "title": "scalar_string_1" }, { "type": "float", - "title": "ComplexType_a_float_float", + "title": "scalar_float_1", "minimum": 1.0, "multipleOf": 2.0 }, { "type": "string", - "title": "ComplexType_an_enum_string_enum", + "title": "scalar_string_enum_1", "enum": [ "\\\\"one\\\\"", "\\\\"two\\\\"" @@ -747,7 +747,7 @@ snapshot[`typegraphs creation 4`] = ` }, { "type": "integer", - "title": "ComplexType_an_integer_enum_integer_enum", + "title": "scalar_integer_enum_1", "enum": [ "1", "2" @@ -755,7 +755,7 @@ snapshot[`typegraphs creation 4`] = ` }, { "type": "float", - "title": "ComplexType_a_float_enum_float", + "title": "scalar_float_2", "enum": [ "1.5", "2.5" @@ -775,7 +775,7 @@ snapshot[`typegraphs creation 4`] = ` }, { "type": "float", - "title": "ComplexType_a_struct_struct_value_float" + "title": "scalar_float_3" }, { "type": "optional", @@ -798,7 +798,7 @@ snapshot[`typegraphs creation 4`] = ` }, { "type": "integer", - "title": "ComplexType_nested_either_t1_integer" + "title": "scalar_integer_1" }, { "type": "object", @@ -828,12 +828,12 @@ snapshot[`typegraphs creation 4`] = ` }, { "type": "string", - "title": "ComplexType_an_email_string_email", + "title": "scalar_string_email_1", "format": "email" }, { "type": "boolean", - "title": "root_test_fn_output" + "title": "scalar_boolean_1" } ], "materializers": [ @@ -971,7 +971,7 @@ snapshot[`typegraphs creation 5`] = ` }, { "type": "object", - "title": "root_add_fn_input", + "title": "scalar_struct_shared_1", "properties": { "first": 3, "second": 3 @@ -985,7 +985,7 @@ snapshot[`typegraphs creation 5`] = ` }, { "type": "float", - "title": "root_add_fn_input_first_float" + "title": "scalar_float_1" }, { "type": "function", @@ -1123,7 +1123,7 @@ snapshot[`typegraphs creation 6`] = ` }, { "type": "object", - "title": "root_one_fn_input", + "title": "scalar_struct_shared_1", "properties": { "a": 3, "b": 4 @@ -1137,16 +1137,16 @@ snapshot[`typegraphs creation 6`] = ` }, { "type": "integer", - "title": "root_one_fn_input_a_integer" + "title": "scalar_integer_1" }, { "type": "integer", - "title": "root_one_fn_input_b_integer", + "title": "scalar_integer_2", "minimum": 12 }, { "type": "integer", - "title": "root_one_fn_output", + "title": "scalar_integer_3", "minimum": 12, "maximum": 43 }, diff --git a/tests/metagen/__snapshots__/metagen_test.ts.snap b/tests/metagen/__snapshots__/metagen_test.ts.snap index 76e6d03fa..3e1fa9f72 100644 --- a/tests/metagen/__snapshots__/metagen_test.ts.snap +++ b/tests/metagen/__snapshots__/metagen_test.ts.snap @@ -91,11 +91,11 @@ class Struct: @dataclass -class RootOneFnInput(Struct): +class ScalarStructShared1(Struct): name: str -FORWARD_REFS["RootOneFnInput"] = RootOneFnInput +FORWARD_REFS["ScalarStructShared1"] = ScalarStructShared1 @dataclass @@ -116,9 +116,9 @@ def __repr(value: Any): -def typed_three(user_fn: Callable[[RootOneFnInput, Ctx], Student]): +def typed_three(user_fn: Callable[[ScalarStructShared1, Ctx], Student]): def exported_wrapper(raw_inp, ctx): - inp: RootOneFnInput = Struct.new(RootOneFnInput, raw_inp) + inp: ScalarStructShared1 = Struct.new(ScalarStructShared1, raw_inp) out: Student = user_fn(inp, ctx) if isinstance(out, list): return [__repr(v) for v in out] @@ -136,11 +136,11 @@ def typed_three(user_fn: Callable[[RootOneFnInput, Ctx], Student]): # are supported. I.e. prefixed by \`.\` or \`..\` # - Make sure to include any module imports in the \`deps\` # array when using external modules with PythonRuntime -from .other_types import RootOneFnInput, Student, typed_three +from .other_types import ScalarStructShared1, Student, typed_three @typed_three -def three(inp: RootOneFnInput, ctx: Ctx) -> Student: +def three(inp: ScalarStructShared1, ctx: Ctx) -> Student: # TODO: write your logic here raise Exception("three not implemented") @@ -237,11 +237,11 @@ class Struct: @dataclass -class RootOneFnInput(Struct): +class ScalarStructShared1(Struct): name: str -FORWARD_REFS["RootOneFnInput"] = RootOneFnInput +FORWARD_REFS["ScalarStructShared1"] = ScalarStructShared1 @dataclass @@ -263,7 +263,7 @@ FORWARD_REFS["TwoInput"] = TwoInput TypeRootOneFnOutput = List["Student"] -TypeRootOneFnInputNameString = str +TypeScalarString1 = str def __repr(value: Any): if isinstance(value, Struct): @@ -272,9 +272,9 @@ def __repr(value: Any): -def typed_fnOne(user_fn: Callable[[RootOneFnInput, Ctx], TypeRootOneFnOutput]): +def typed_fnOne(user_fn: Callable[[ScalarStructShared1, Ctx], TypeRootOneFnOutput]): def exported_wrapper(raw_inp, ctx): - inp: RootOneFnInput = Struct.new(RootOneFnInput, raw_inp) + inp: ScalarStructShared1 = Struct.new(ScalarStructShared1, raw_inp) out: TypeRootOneFnOutput = user_fn(inp, ctx) if isinstance(out, list): return [__repr(v) for v in out] @@ -283,10 +283,10 @@ def typed_fnOne(user_fn: Callable[[RootOneFnInput, Ctx], TypeRootOneFnOutput]): return exported_wrapper -def typed_fnTwo(user_fn: Callable[[TwoInput, Ctx], TypeRootOneFnInputNameString]): +def typed_fnTwo(user_fn: Callable[[TwoInput, Ctx], TypeScalarString1]): def exported_wrapper(raw_inp, ctx): inp: TwoInput = Struct.new(TwoInput, raw_inp) - out: TypeRootOneFnInputNameString = user_fn(inp, ctx) + out: TypeScalarString1 = user_fn(inp, ctx) if isinstance(out, list): return [__repr(v) for v in out] return __repr(out) @@ -303,16 +303,16 @@ def typed_fnTwo(user_fn: Callable[[TwoInput, Ctx], TypeRootOneFnInputNameString] # are supported. I.e. prefixed by \`.\` or \`..\` # - Make sure to include any module imports in the \`deps\` # array when using external modules with PythonRuntime -from .same_hit_types import RootOneFnInput, TwoInput, TypeRootOneFnInputNameString, TypeRootOneFnOutput, typed_fnOne, typed_fnTwo +from .same_hit_types import ScalarStructShared1, TwoInput, TypeRootOneFnOutput, TypeScalarString1, typed_fnOne, typed_fnTwo @typed_fnOne -def fnOne(inp: RootOneFnInput, ctx: Ctx) -> TypeRootOneFnOutput: +def fnOne(inp: ScalarStructShared1, ctx: Ctx) -> TypeRootOneFnOutput: # TODO: write your logic here raise Exception("fnOne not implemented") @typed_fnTwo -def fnTwo(inp: TwoInput, ctx: Ctx) -> TypeRootOneFnInputNameString: +def fnTwo(inp: TwoInput, ctx: Ctx) -> TypeScalarString1: # TODO: write your logic here raise Exception("fnTwo not implemented") @@ -564,23 +564,23 @@ macro_rules! init_mat { // gen-static-end use types::*; pub mod types { - pub type RootOneFnInputNameString = String; + pub type ScalarString1 = String; #[derive(Debug, serde::Serialize, serde::Deserialize)] - pub struct RootOneFnInput { - pub name: RootOneFnInputNameString, + pub struct ScalarStructShared1 { + pub name: ScalarString1, } - pub type StudentIdInteger = i64; + pub type ScalarInteger1 = i64; pub type StudentPeersPlaceholderOptional = Option; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct Student { - pub id: StudentIdInteger, - pub name: RootOneFnInputNameString, + pub id: ScalarInteger1, + pub name: ScalarString1, pub peers: StudentPeersPlaceholderOptional, } pub type RootOneFnOutput = Vec; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct TwoInput { - pub name: RootOneFnInputNameString, + pub name: ScalarString1, } } pub mod stubs { @@ -603,7 +603,7 @@ pub mod stubs { } } - fn handle(&self, input: RootOneFnInput, cx: Ctx) -> anyhow::Result; + fn handle(&self, input: ScalarStructShared1, cx: Ctx) -> anyhow::Result; } pub trait RootTwoFn: Sized + 'static { fn erased(self) -> ErasedHandler { @@ -623,7 +623,7 @@ pub mod stubs { } } - fn handle(&self, input: TwoInput, cx: Ctx) -> anyhow::Result; + fn handle(&self, input: TwoInput, cx: Ctx) -> anyhow::Result; } pub trait RootThreeFn: Sized + 'static { fn erased(self) -> ErasedHandler { @@ -643,7 +643,7 @@ pub mod stubs { } } - fn handle(&self, input: RootOneFnInput, cx: Ctx) -> anyhow::Result; + fn handle(&self, input: ScalarStructShared1, cx: Ctx) -> anyhow::Result; } pub fn op_to_trait_name(op_name: &str) -> &'static str { match op_name { @@ -719,26 +719,26 @@ export type Handler = ( tg: Deployment, ) => Out | Promise; -export type RootOneFnInputNameString = string; -export type RootOneFnInput = { - name: RootOneFnInputNameString; +export type ScalarString1 = string; +export type ScalarStructShared1 = { + name: ScalarString1; }; -export type StudentIdInteger = number; +export type ScalarInteger1 = number; export type StudentPeersPlaceholderOptional = RootOneFnOutput | null | undefined; export type Student = { - id: StudentIdInteger; - name: RootOneFnInputNameString; + id: ScalarInteger1; + name: ScalarString1; peers?: StudentPeersPlaceholderOptional; }; export type RootOneFnOutput = Array; export type TwoInput = { - name: RootOneFnInputNameString; + name: ScalarString1; }; -export type RootOneFnHandler = Handler; -export type RootTwoFnHandler = Handler; -export type RootThreeFnHandler = Handler; +export type RootOneFnHandler = Handler; +export type RootTwoFnHandler = Handler; +export type RootThreeFnHandler = Handler; ', overwrite: true, path: "./workspace/some/base/path/ts/fdk.ts", @@ -892,11 +892,11 @@ class Struct: @dataclass -class RootOneFnInput(Struct): +class ScalarStructShared1(Struct): name: str -FORWARD_REFS["RootOneFnInput"] = RootOneFnInput +FORWARD_REFS["ScalarStructShared1"] = ScalarStructShared1 @dataclass @@ -917,9 +917,9 @@ def __repr(value: Any): -def typed_three(user_fn: Callable[[RootOneFnInput, Ctx], Student]): +def typed_three(user_fn: Callable[[ScalarStructShared1, Ctx], Student]): def exported_wrapper(raw_inp, ctx): - inp: RootOneFnInput = Struct.new(RootOneFnInput, raw_inp) + inp: ScalarStructShared1 = Struct.new(ScalarStructShared1, raw_inp) out: Student = user_fn(inp, ctx) if isinstance(out, list): return [__repr(v) for v in out] @@ -937,11 +937,11 @@ def typed_three(user_fn: Callable[[RootOneFnInput, Ctx], Student]): # are supported. I.e. prefixed by \`.\` or \`..\` # - Make sure to include any module imports in the \`deps\` # array when using external modules with PythonRuntime -from .other_types import RootOneFnInput, Student, typed_three +from .other_types import ScalarStructShared1, Student, typed_three @typed_three -def three(inp: RootOneFnInput, ctx: Ctx) -> Student: +def three(inp: ScalarStructShared1, ctx: Ctx) -> Student: # TODO: write your logic here raise Exception("three not implemented") @@ -1038,11 +1038,11 @@ class Struct: @dataclass -class RootOneFnInput(Struct): +class ScalarStructShared1(Struct): name: str -FORWARD_REFS["RootOneFnInput"] = RootOneFnInput +FORWARD_REFS["ScalarStructShared1"] = ScalarStructShared1 @dataclass @@ -1064,7 +1064,7 @@ FORWARD_REFS["TwoInput"] = TwoInput TypeRootOneFnOutput = List["Student"] -TypeRootOneFnInputNameString = str +TypeScalarString1 = str def __repr(value: Any): if isinstance(value, Struct): @@ -1073,9 +1073,9 @@ def __repr(value: Any): -def typed_fnOne(user_fn: Callable[[RootOneFnInput, Ctx], TypeRootOneFnOutput]): +def typed_fnOne(user_fn: Callable[[ScalarStructShared1, Ctx], TypeRootOneFnOutput]): def exported_wrapper(raw_inp, ctx): - inp: RootOneFnInput = Struct.new(RootOneFnInput, raw_inp) + inp: ScalarStructShared1 = Struct.new(ScalarStructShared1, raw_inp) out: TypeRootOneFnOutput = user_fn(inp, ctx) if isinstance(out, list): return [__repr(v) for v in out] @@ -1084,10 +1084,10 @@ def typed_fnOne(user_fn: Callable[[RootOneFnInput, Ctx], TypeRootOneFnOutput]): return exported_wrapper -def typed_fnTwo(user_fn: Callable[[TwoInput, Ctx], TypeRootOneFnInputNameString]): +def typed_fnTwo(user_fn: Callable[[TwoInput, Ctx], TypeScalarString1]): def exported_wrapper(raw_inp, ctx): inp: TwoInput = Struct.new(TwoInput, raw_inp) - out: TypeRootOneFnInputNameString = user_fn(inp, ctx) + out: TypeScalarString1 = user_fn(inp, ctx) if isinstance(out, list): return [__repr(v) for v in out] return __repr(out) @@ -1104,16 +1104,16 @@ def typed_fnTwo(user_fn: Callable[[TwoInput, Ctx], TypeRootOneFnInputNameString] # are supported. I.e. prefixed by \`.\` or \`..\` # - Make sure to include any module imports in the \`deps\` # array when using external modules with PythonRuntime -from .same_hit_types import RootOneFnInput, TwoInput, TypeRootOneFnInputNameString, TypeRootOneFnOutput, typed_fnOne, typed_fnTwo +from .same_hit_types import ScalarStructShared1, TwoInput, TypeRootOneFnOutput, TypeScalarString1, typed_fnOne, typed_fnTwo @typed_fnOne -def fnOne(inp: RootOneFnInput, ctx: Ctx) -> TypeRootOneFnOutput: +def fnOne(inp: ScalarStructShared1, ctx: Ctx) -> TypeRootOneFnOutput: # TODO: write your logic here raise Exception("fnOne not implemented") @typed_fnTwo -def fnTwo(inp: TwoInput, ctx: Ctx) -> TypeRootOneFnInputNameString: +def fnTwo(inp: TwoInput, ctx: Ctx) -> TypeScalarString1: # TODO: write your logic here raise Exception("fnTwo not implemented") @@ -1365,23 +1365,23 @@ macro_rules! init_mat { // gen-static-end use types::*; pub mod types { - pub type RootOneFnInputNameString = String; + pub type ScalarString1 = String; #[derive(Debug, serde::Serialize, serde::Deserialize)] - pub struct RootOneFnInput { - pub name: RootOneFnInputNameString, + pub struct ScalarStructShared1 { + pub name: ScalarString1, } - pub type StudentIdInteger = i64; + pub type ScalarInteger1 = i64; pub type StudentPeersPlaceholderOptional = Option; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct Student { - pub id: StudentIdInteger, - pub name: RootOneFnInputNameString, + pub id: ScalarInteger1, + pub name: ScalarString1, pub peers: StudentPeersPlaceholderOptional, } pub type RootOneFnOutput = Vec; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct TwoInput { - pub name: RootOneFnInputNameString, + pub name: ScalarString1, } } pub mod stubs { @@ -1404,7 +1404,7 @@ pub mod stubs { } } - fn handle(&self, input: RootOneFnInput, cx: Ctx) -> anyhow::Result; + fn handle(&self, input: ScalarStructShared1, cx: Ctx) -> anyhow::Result; } pub trait RootTwoFn: Sized + 'static { fn erased(self) -> ErasedHandler { @@ -1424,7 +1424,7 @@ pub mod stubs { } } - fn handle(&self, input: TwoInput, cx: Ctx) -> anyhow::Result; + fn handle(&self, input: TwoInput, cx: Ctx) -> anyhow::Result; } pub trait RootThreeFn: Sized + 'static { fn erased(self) -> ErasedHandler { @@ -1444,7 +1444,7 @@ pub mod stubs { } } - fn handle(&self, input: RootOneFnInput, cx: Ctx) -> anyhow::Result; + fn handle(&self, input: ScalarStructShared1, cx: Ctx) -> anyhow::Result; } pub fn op_to_trait_name(op_name: &str) -> &'static str { match op_name { @@ -1520,26 +1520,26 @@ export type Handler = ( tg: Deployment, ) => Out | Promise; -export type RootOneFnInputNameString = string; -export type RootOneFnInput = { - name: RootOneFnInputNameString; +export type ScalarString1 = string; +export type ScalarStructShared1 = { + name: ScalarString1; }; -export type StudentIdInteger = number; +export type ScalarInteger1 = number; export type StudentPeersPlaceholderOptional = RootOneFnOutput | null | undefined; export type Student = { - id: StudentIdInteger; - name: RootOneFnInputNameString; + id: ScalarInteger1; + name: ScalarString1; peers?: StudentPeersPlaceholderOptional; }; export type RootOneFnOutput = Array; export type TwoInput = { - name: RootOneFnInputNameString; + name: ScalarString1; }; -export type RootOneFnHandler = Handler; -export type RootTwoFnHandler = Handler; -export type RootThreeFnHandler = Handler; +export type RootOneFnHandler = Handler; +export type RootTwoFnHandler = Handler; +export type RootThreeFnHandler = Handler; ', overwrite: true, path: "./workspace/some/base/path/ts/fdk.ts", @@ -1693,11 +1693,11 @@ class Struct: @dataclass -class MyNamespaceRootOneFnInput(Struct): +class MyNamespaceScalarStructShared1(Struct): name: str -FORWARD_REFS["RootOneFnInput"] = RootOneFnInput +FORWARD_REFS["ScalarStructShared1"] = ScalarStructShared1 @dataclass @@ -1718,9 +1718,9 @@ def __repr(value: Any): -def typed_three(user_fn: Callable[[RootOneFnInput, Ctx], Student]): +def typed_three(user_fn: Callable[[ScalarStructShared1, Ctx], Student]): def exported_wrapper(raw_inp, ctx): - inp: RootOneFnInput = Struct.new(RootOneFnInput, raw_inp) + inp: ScalarStructShared1 = Struct.new(ScalarStructShared1, raw_inp) out: Student = user_fn(inp, ctx) if isinstance(out, list): return [__repr(v) for v in out] @@ -1738,11 +1738,11 @@ def typed_three(user_fn: Callable[[RootOneFnInput, Ctx], Student]): # are supported. I.e. prefixed by \`.\` or \`..\` # - Make sure to include any module imports in the \`deps\` # array when using external modules with PythonRuntime -from .other_types import RootOneFnInput, Student, typed_three +from .other_types import ScalarStructShared1, Student, typed_three @typed_three -def three(inp: RootOneFnInput, ctx: Ctx) -> Student: +def three(inp: ScalarStructShared1, ctx: Ctx) -> Student: # TODO: write your logic here raise Exception("three not implemented") @@ -1839,11 +1839,11 @@ class Struct: @dataclass -class MyNamespaceRootOneFnInput(Struct): +class MyNamespaceScalarStructShared1(Struct): name: str -FORWARD_REFS["RootOneFnInput"] = RootOneFnInput +FORWARD_REFS["ScalarStructShared1"] = ScalarStructShared1 @dataclass @@ -1865,7 +1865,7 @@ FORWARD_REFS["TwoInput"] = TwoInput TypeRootOneFnOutput = List["Student"] -TypeRootOneFnInputNameString = str +TypeScalarString1 = str def __repr(value: Any): if isinstance(value, Struct): @@ -1874,9 +1874,9 @@ def __repr(value: Any): -def typed_fnOne(user_fn: Callable[[RootOneFnInput, Ctx], TypeRootOneFnOutput]): +def typed_fnOne(user_fn: Callable[[ScalarStructShared1, Ctx], TypeRootOneFnOutput]): def exported_wrapper(raw_inp, ctx): - inp: RootOneFnInput = Struct.new(RootOneFnInput, raw_inp) + inp: ScalarStructShared1 = Struct.new(ScalarStructShared1, raw_inp) out: TypeRootOneFnOutput = user_fn(inp, ctx) if isinstance(out, list): return [__repr(v) for v in out] @@ -1885,10 +1885,10 @@ def typed_fnOne(user_fn: Callable[[RootOneFnInput, Ctx], TypeRootOneFnOutput]): return exported_wrapper -def typed_fnTwo(user_fn: Callable[[TwoInput, Ctx], TypeRootOneFnInputNameString]): +def typed_fnTwo(user_fn: Callable[[TwoInput, Ctx], TypeScalarString1]): def exported_wrapper(raw_inp, ctx): inp: TwoInput = Struct.new(TwoInput, raw_inp) - out: TypeRootOneFnInputNameString = user_fn(inp, ctx) + out: TypeScalarString1 = user_fn(inp, ctx) if isinstance(out, list): return [__repr(v) for v in out] return __repr(out) @@ -1905,16 +1905,16 @@ def typed_fnTwo(user_fn: Callable[[TwoInput, Ctx], TypeRootOneFnInputNameString] # are supported. I.e. prefixed by \`.\` or \`..\` # - Make sure to include any module imports in the \`deps\` # array when using external modules with PythonRuntime -from .same_hit_types import RootOneFnInput, TwoInput, TypeRootOneFnInputNameString, TypeRootOneFnOutput, typed_fnOne, typed_fnTwo +from .same_hit_types import ScalarStructShared1, TwoInput, TypeRootOneFnOutput, TypeScalarString1, typed_fnOne, typed_fnTwo @typed_fnOne -def fnOne(inp: RootOneFnInput, ctx: Ctx) -> TypeRootOneFnOutput: +def fnOne(inp: ScalarStructShared1, ctx: Ctx) -> TypeRootOneFnOutput: # TODO: write your logic here raise Exception("fnOne not implemented") @typed_fnTwo -def fnTwo(inp: TwoInput, ctx: Ctx) -> TypeRootOneFnInputNameString: +def fnTwo(inp: TwoInput, ctx: Ctx) -> TypeScalarString1: # TODO: write your logic here raise Exception("fnTwo not implemented") @@ -2016,11 +2016,11 @@ class Struct: @dataclass -class MyNamespaceRootOneFnInput(Struct): +class MyNamespaceScalarStructShared1(Struct): name: str -FORWARD_REFS["RootOneFnInput"] = RootOneFnInput +FORWARD_REFS["ScalarStructShared1"] = ScalarStructShared1 @dataclass @@ -2041,9 +2041,9 @@ def __repr(value: Any): -def typed_three(user_fn: Callable[[RootOneFnInput, Ctx], Student]): +def typed_three(user_fn: Callable[[ScalarStructShared1, Ctx], Student]): def exported_wrapper(raw_inp, ctx): - inp: RootOneFnInput = Struct.new(RootOneFnInput, raw_inp) + inp: ScalarStructShared1 = Struct.new(ScalarStructShared1, raw_inp) out: Student = user_fn(inp, ctx) if isinstance(out, list): return [__repr(v) for v in out] @@ -2061,11 +2061,11 @@ def typed_three(user_fn: Callable[[RootOneFnInput, Ctx], Student]): # are supported. I.e. prefixed by \`.\` or \`..\` # - Make sure to include any module imports in the \`deps\` # array when using external modules with PythonRuntime -from .other_types import RootOneFnInput, Student, typed_three +from .other_types import ScalarStructShared1, Student, typed_three @typed_three -def three(inp: RootOneFnInput, ctx: Ctx) -> Student: +def three(inp: ScalarStructShared1, ctx: Ctx) -> Student: # TODO: write your logic here raise Exception("three not implemented") @@ -2162,11 +2162,11 @@ class Struct: @dataclass -class MyNamespaceRootOneFnInput(Struct): +class MyNamespaceScalarStructShared1(Struct): name: str -FORWARD_REFS["RootOneFnInput"] = RootOneFnInput +FORWARD_REFS["ScalarStructShared1"] = ScalarStructShared1 @dataclass @@ -2188,7 +2188,7 @@ FORWARD_REFS["TwoInput"] = TwoInput TypeRootOneFnOutput = List["Student"] -TypeRootOneFnInputNameString = str +TypeScalarString1 = str def __repr(value: Any): if isinstance(value, Struct): @@ -2197,9 +2197,9 @@ def __repr(value: Any): -def typed_fnOne(user_fn: Callable[[RootOneFnInput, Ctx], TypeRootOneFnOutput]): +def typed_fnOne(user_fn: Callable[[ScalarStructShared1, Ctx], TypeRootOneFnOutput]): def exported_wrapper(raw_inp, ctx): - inp: RootOneFnInput = Struct.new(RootOneFnInput, raw_inp) + inp: ScalarStructShared1 = Struct.new(ScalarStructShared1, raw_inp) out: TypeRootOneFnOutput = user_fn(inp, ctx) if isinstance(out, list): return [__repr(v) for v in out] @@ -2208,10 +2208,10 @@ def typed_fnOne(user_fn: Callable[[RootOneFnInput, Ctx], TypeRootOneFnOutput]): return exported_wrapper -def typed_fnTwo(user_fn: Callable[[TwoInput, Ctx], TypeRootOneFnInputNameString]): +def typed_fnTwo(user_fn: Callable[[TwoInput, Ctx], TypeScalarString1]): def exported_wrapper(raw_inp, ctx): inp: TwoInput = Struct.new(TwoInput, raw_inp) - out: TypeRootOneFnInputNameString = user_fn(inp, ctx) + out: TypeScalarString1 = user_fn(inp, ctx) if isinstance(out, list): return [__repr(v) for v in out] return __repr(out) @@ -2228,16 +2228,16 @@ def typed_fnTwo(user_fn: Callable[[TwoInput, Ctx], TypeRootOneFnInputNameString] # are supported. I.e. prefixed by \`.\` or \`..\` # - Make sure to include any module imports in the \`deps\` # array when using external modules with PythonRuntime -from .same_hit_types import RootOneFnInput, TwoInput, TypeRootOneFnInputNameString, TypeRootOneFnOutput, typed_fnOne, typed_fnTwo +from .same_hit_types import ScalarStructShared1, TwoInput, TypeRootOneFnOutput, TypeScalarString1, typed_fnOne, typed_fnTwo @typed_fnOne -def fnOne(inp: RootOneFnInput, ctx: Ctx) -> TypeRootOneFnOutput: +def fnOne(inp: ScalarStructShared1, ctx: Ctx) -> TypeRootOneFnOutput: # TODO: write your logic here raise Exception("fnOne not implemented") @typed_fnTwo -def fnTwo(inp: TwoInput, ctx: Ctx) -> TypeRootOneFnInputNameString: +def fnTwo(inp: TwoInput, ctx: Ctx) -> TypeScalarString1: # TODO: write your logic here raise Exception("fnTwo not implemented") diff --git a/tests/metagen/typegraphs/identities/rs/fdk.rs b/tests/metagen/typegraphs/identities/rs/fdk.rs index e5cc2e6a7..00db94ab4 100644 --- a/tests/metagen/typegraphs/identities/rs/fdk.rs +++ b/tests/metagen/typegraphs/identities/rs/fdk.rs @@ -219,42 +219,42 @@ macro_rules! init_mat { // gen-static-end use types::*; pub mod types { - pub type PrimitivesStrString = String; - pub type PrimitivesEnumStringEnum = String; - pub type PrimitivesUuidStringUuid = String; - pub type PrimitivesEmailStringEmail = String; - pub type PrimitivesEanStringEan = String; - pub type PrimitivesJsonStringJson = String; - pub type PrimitivesUriStringUri = String; - pub type PrimitivesDateStringDate = String; - pub type PrimitivesDatetimeStringDatetime = String; - pub type PrimitivesIntInteger = i64; - pub type PrimitivesFloatFloat = f64; - pub type PrimitivesBooleanBoolean = bool; + pub type ScalarString1 = String; + pub type ScalarStringEnum1 = String; + pub type ScalarStringUuid1 = String; + pub type ScalarStringEmail1 = String; + pub type ScalarStringEan1 = String; + pub type ScalarStringJson1 = String; + pub type ScalarStringUri1 = String; + pub type ScalarStringDate1 = String; + pub type ScalarStringDatetime1 = String; + pub type ScalarInteger1 = i64; + pub type ScalarFloat1 = f64; + pub type ScalarBoolean1 = bool; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct Primitives { - pub str: PrimitivesStrString, + pub str: ScalarString1, #[serde(rename = "enum")] - pub r#enum: PrimitivesEnumStringEnum, - pub uuid: PrimitivesUuidStringUuid, - pub email: PrimitivesEmailStringEmail, - pub ean: PrimitivesEanStringEan, - pub json: PrimitivesJsonStringJson, - pub uri: PrimitivesUriStringUri, - pub date: PrimitivesDateStringDate, - pub datetime: PrimitivesDatetimeStringDatetime, - pub int: PrimitivesIntInteger, - pub float: PrimitivesFloatFloat, - pub boolean: PrimitivesBooleanBoolean, + pub r#enum: ScalarStringEnum1, + pub uuid: ScalarStringUuid1, + pub email: ScalarStringEmail1, + pub ean: ScalarStringEan1, + pub json: ScalarStringJson1, + pub uri: ScalarStringUri1, + pub date: ScalarStringDate1, + pub datetime: ScalarStringDatetime1, + pub int: ScalarInteger1, + pub float: ScalarFloat1, + pub boolean: ScalarBoolean1, } #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct PrimitivesArgs { pub data: Primitives, } - pub type CompositesOptPrimitivesStrStringOptional = Option; + pub type CompositesOptScalarString1Optional = Option; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct Branch2 { - pub branch2: PrimitivesStrString, + pub branch2: ScalarString1, } #[derive(Debug, serde::Serialize, serde::Deserialize)] #[serde(untagged)] @@ -262,24 +262,24 @@ pub mod types { Primitives(Primitives), Branch2(Branch2), } - pub type CompositesUnionUnionT0StringEnum = String; - pub type Branch4 = Vec; + pub type ScalarStringEnum2 = String; + pub type Branch4 = Vec; pub type Branch4again = String; #[derive(Debug, serde::Serialize, serde::Deserialize)] #[serde(untagged)] pub enum CompositesUnionUnion { Branch4(Branch4), - PrimitivesIntInteger(PrimitivesIntInteger), - PrimitivesStrString(PrimitivesStrString), + ScalarInteger1(ScalarInteger1), + ScalarString1(ScalarString1), Branch4again(Branch4again), } - pub type CompositesListPrimitivesStrStringList = Vec; + pub type CompositesListScalarString1List = Vec; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct Composites { - pub opt: CompositesOptPrimitivesStrStringOptional, + pub opt: CompositesOptScalarString1Optional, pub either: CompositesEitherEither, pub union: CompositesUnionUnion, - pub list: CompositesListPrimitivesStrStringList, + pub list: CompositesListScalarString1List, } #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct CompositesArgs { @@ -288,12 +288,12 @@ pub mod types { pub type Branch33ATo1Cycles1Optional = Option; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct Branch33A { - pub phantom3a: CompositesOptPrimitivesStrStringOptional, + pub phantom3a: CompositesOptScalarString1Optional, pub to1: Branch33ATo1Cycles1Optional, } #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct Branch33B { - pub phantom3b: CompositesOptPrimitivesStrStringOptional, + pub phantom3b: CompositesOptScalarString1Optional, pub to2: Cycles1To2Cycles2Optional, } #[derive(Debug, serde::Serialize, serde::Deserialize)] @@ -313,7 +313,7 @@ pub mod types { pub type Cycles1List3Cycles1List3Cycles3ListOptional = Option; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct Cycles1 { - pub phantom1: CompositesOptPrimitivesStrStringOptional, + pub phantom1: CompositesOptScalarString1Optional, pub to2: Box, pub list3: Cycles1List3Cycles1List3Cycles3ListOptional, } @@ -324,19 +324,19 @@ pub mod types { pub type SimpleCycles3To1SimpleCycles1Optional = Option; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct SimpleCycles3 { - pub phantom3: CompositesOptPrimitivesStrStringOptional, + pub phantom3: CompositesOptScalarString1Optional, pub to1: SimpleCycles3To1SimpleCycles1Optional, } pub type SimpleCycles2To3SimpleCycles3Optional = Option; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct SimpleCycles2 { - pub phantom2: CompositesOptPrimitivesStrStringOptional, + pub phantom2: CompositesOptScalarString1Optional, pub to3: SimpleCycles2To3SimpleCycles3Optional, } pub type SimpleCycles1To2SimpleCycles2Optional = Option; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct SimpleCycles1 { - pub phantom1: CompositesOptPrimitivesStrStringOptional, + pub phantom1: CompositesOptScalarString1Optional, pub to2: Box, } #[derive(Debug, serde::Serialize, serde::Deserialize)] diff --git a/tests/metagen/typegraphs/identities/ts/fdk.ts b/tests/metagen/typegraphs/identities/ts/fdk.ts index 80702013e..61e714220 100644 --- a/tests/metagen/typegraphs/identities/ts/fdk.ts +++ b/tests/metagen/typegraphs/identities/ts/fdk.ts @@ -33,67 +33,67 @@ export type Handler = ( tg: Deployment, ) => Out | Promise; -export type PrimitivesStrString = string; -export type PrimitivesEnumStringEnum = "wan" | "tew" | "tree"; -export type PrimitivesUuidStringUuid = string; -export type PrimitivesEmailStringEmail = string; -export type PrimitivesEanStringEan = string; -export type PrimitivesJsonStringJson = string; -export type PrimitivesUriStringUri = string; -export type PrimitivesDateStringDate = string; -export type PrimitivesDatetimeStringDatetime = string; -export type PrimitivesIntInteger = number; -export type PrimitivesFloatFloat = number; -export type PrimitivesBooleanBoolean = boolean; +export type ScalarString1 = string; +export type ScalarStringEnum1 = "wan" | "tew" | "tree"; +export type ScalarStringUuid1 = string; +export type ScalarStringEmail1 = string; +export type ScalarStringEan1 = string; +export type ScalarStringJson1 = string; +export type ScalarStringUri1 = string; +export type ScalarStringDate1 = string; +export type ScalarStringDatetime1 = string; +export type ScalarInteger1 = number; +export type ScalarFloat1 = number; +export type ScalarBoolean1 = boolean; export type Primitives = { - str: PrimitivesStrString; - "enum": PrimitivesEnumStringEnum; - uuid: PrimitivesUuidStringUuid; - email: PrimitivesEmailStringEmail; - ean: PrimitivesEanStringEan; - json: PrimitivesJsonStringJson; - uri: PrimitivesUriStringUri; - date: PrimitivesDateStringDate; - datetime: PrimitivesDatetimeStringDatetime; - int: PrimitivesIntInteger; - float: PrimitivesFloatFloat; - "boolean": PrimitivesBooleanBoolean; + str: ScalarString1; + "enum": ScalarStringEnum1; + uuid: ScalarStringUuid1; + email: ScalarStringEmail1; + ean: ScalarStringEan1; + json: ScalarStringJson1; + uri: ScalarStringUri1; + date: ScalarStringDate1; + datetime: ScalarStringDatetime1; + int: ScalarInteger1; + float: ScalarFloat1; + "boolean": ScalarBoolean1; }; export type PrimitivesArgs = { data: Primitives; }; -export type CompositesOptPrimitivesStrStringOptional = PrimitivesStrString | null | undefined; +export type CompositesOptScalarString1Optional = ScalarString1 | null | undefined; export type Branch2 = { - branch2: PrimitivesStrString; + branch2: ScalarString1; }; export type CompositesEitherEither = | (Primitives) | (Branch2); -export type CompositesUnionUnionT0StringEnum = "grey" | "beige"; -export type Branch4 = Array; +export type ScalarStringEnum2 = "grey" | "beige"; +export type Branch4 = Array; export type Branch4again = string; export type CompositesUnionUnion = | (Branch4) - | (PrimitivesIntInteger) - | (PrimitivesStrString) + | (ScalarInteger1) + | (ScalarString1) | (Branch4again); -export type CompositesListPrimitivesStrStringList = Array; +export type CompositesListScalarString1List = Array; export type Composites = { - opt?: CompositesOptPrimitivesStrStringOptional; + opt?: CompositesOptScalarString1Optional; either: CompositesEitherEither; union: CompositesUnionUnion; - list: CompositesListPrimitivesStrStringList; + list: CompositesListScalarString1List; }; export type CompositesArgs = { data: Composites; }; export type Branch33ATo1Cycles1Optional = Cycles1 | null | undefined; export type Branch33A = { - phantom3a?: CompositesOptPrimitivesStrStringOptional; + phantom3a?: CompositesOptScalarString1Optional; to1?: Branch33ATo1Cycles1Optional; }; export type Branch33B = { - phantom3b?: CompositesOptPrimitivesStrStringOptional; + phantom3b?: CompositesOptScalarString1Optional; to2?: Cycles1To2Cycles2Optional; }; export type Cycles3 = @@ -106,7 +106,7 @@ export type Cycles1To2Cycles2Optional = Cycles2 | null | undefined; export type Cycles1List3Cycles3List = Array; export type Cycles1List3Cycles1List3Cycles3ListOptional = Cycles1List3Cycles3List | null | undefined; export type Cycles1 = { - phantom1?: CompositesOptPrimitivesStrStringOptional; + phantom1?: CompositesOptScalarString1Optional; to2?: Cycles1To2Cycles2Optional; list3?: Cycles1List3Cycles1List3Cycles3ListOptional; }; @@ -115,17 +115,17 @@ export type Cycles1Args = { }; export type SimpleCycles3To1SimpleCycles1Optional = SimpleCycles1 | null | undefined; export type SimpleCycles3 = { - phantom3?: CompositesOptPrimitivesStrStringOptional; + phantom3?: CompositesOptScalarString1Optional; to1?: SimpleCycles3To1SimpleCycles1Optional; }; export type SimpleCycles2To3SimpleCycles3Optional = SimpleCycles3 | null | undefined; export type SimpleCycles2 = { - phantom2?: CompositesOptPrimitivesStrStringOptional; + phantom2?: CompositesOptScalarString1Optional; to3?: SimpleCycles2To3SimpleCycles3Optional; }; export type SimpleCycles1To2SimpleCycles2Optional = SimpleCycles2 | null | undefined; export type SimpleCycles1 = { - phantom1?: CompositesOptPrimitivesStrStringOptional; + phantom1?: CompositesOptScalarString1Optional; to2?: SimpleCycles1To2SimpleCycles2Optional; }; export type SimpleCycles1Args = { diff --git a/tests/metagen/typegraphs/sample/py/client.py b/tests/metagen/typegraphs/sample/py/client.py index d19492338..85e64bc2e 100644 --- a/tests/metagen/typegraphs/sample/py/client.py +++ b/tests/metagen/typegraphs/sample/py/client.py @@ -872,9 +872,9 @@ def RootScalarArgsFn(): sub_nodes=return_node.sub_nodes, variants=return_node.variants, arg_types={ - "id": "UserIdStringUuid", - "slug": "PostSlugString", - "title": "PostSlugString", + "id": "ScalarStringUuid1", + "slug": "ScalarString1", + "title": "ScalarString1", }, ) @@ -893,7 +893,7 @@ def RootCompositeArgsFn(): sub_nodes=return_node.sub_nodes, variants=return_node.variants, arg_types={ - "id": "PostSlugString", + "id": "ScalarString1", }, ) @@ -904,7 +904,7 @@ def RootScalarUnionFn(): sub_nodes=return_node.sub_nodes, variants=return_node.variants, arg_types={ - "id": "PostSlugString", + "id": "ScalarString1", }, ) @@ -924,7 +924,7 @@ def RootCompositeUnionFn(): sub_nodes=return_node.sub_nodes, variants=return_node.variants, arg_types={ - "id": "PostSlugString", + "id": "ScalarString1", }, ) @@ -944,7 +944,7 @@ def RootMixedUnionFn(): sub_nodes=return_node.sub_nodes, variants=return_node.variants, arg_types={ - "id": "PostSlugString", + "id": "ScalarString1", }, ) @@ -992,47 +992,47 @@ def RootNestedCompositeFn(): ) -UserIdStringUuid = str +ScalarStringUuid1 = str -PostSlugString = str +ScalarString1 = str Post = typing.TypedDict( "Post", { - "id": UserIdStringUuid, - "slug": PostSlugString, - "title": PostSlugString, + "id": ScalarStringUuid1, + "slug": ScalarString1, + "title": ScalarString1, }, total=False, ) -RootCompositeArgsFnInput = typing.TypedDict( - "RootCompositeArgsFnInput", +ScalarStructShared2 = typing.TypedDict( + "ScalarStructShared2", { - "id": PostSlugString, + "id": ScalarString1, }, total=False, ) -UserEmailStringEmail = str +ScalarStringEmail1 = str UserPostsPostList = typing.List[Post] User = typing.TypedDict( "User", { - "id": UserIdStringUuid, - "email": UserEmailStringEmail, + "id": ScalarStringUuid1, + "email": ScalarStringEmail1, "posts": UserPostsPostList, }, total=False, ) -RootScalarUnionFnOutputT1Integer = int +ScalarInteger1 = int RootScalarUnionFnOutput = typing.Union[ - PostSlugString, - RootScalarUnionFnOutputT1Integer, + ScalarString1, + ScalarInteger1, ] @@ -1045,15 +1045,15 @@ def RootNestedCompositeFn(): RootMixedUnionFnOutput = typing.Union[ Post, User, - PostSlugString, - RootScalarUnionFnOutputT1Integer, + ScalarString1, + ScalarInteger1, ] RootNestedCompositeFnOutputCompositeStructNestedStruct = typing.TypedDict( "RootNestedCompositeFnOutputCompositeStructNestedStruct", { - "inner": RootScalarUnionFnOutputT1Integer, + "inner": ScalarInteger1, }, total=False, ) @@ -1061,7 +1061,7 @@ def RootNestedCompositeFn(): RootNestedCompositeFnOutputCompositeStruct = typing.TypedDict( "RootNestedCompositeFnOutputCompositeStruct", { - "value": RootScalarUnionFnOutputT1Integer, + "value": ScalarInteger1, "nested": RootNestedCompositeFnOutputCompositeStructNestedStruct, }, total=False, @@ -1070,7 +1070,7 @@ def RootNestedCompositeFn(): RootNestedCompositeFnOutputListStruct = typing.TypedDict( "RootNestedCompositeFnOutputListStruct", { - "value": RootScalarUnionFnOutputT1Integer, + "value": ScalarInteger1, }, total=False, ) @@ -1082,7 +1082,7 @@ def RootNestedCompositeFn(): RootNestedCompositeFnOutput = typing.TypedDict( "RootNestedCompositeFnOutput", { - "scalar": RootScalarUnionFnOutputT1Integer, + "scalar": ScalarInteger1, "composite": RootNestedCompositeFnOutputCompositeStruct, "list": RootNestedCompositeFnOutputListRootNestedCompositeFnOutputListStructList, }, @@ -1182,8 +1182,8 @@ class QueryGraph(QueryGraphBase): def __init__(self): super().__init__( { - "UserIdStringUuid": "String!", - "PostSlugString": "String!", + "ScalarStringUuid1": "String!", + "ScalarString1": "String!", "post": "post!", "user": "user!", } @@ -1205,7 +1205,7 @@ def get_posts(self, select: PostSelections) -> QueryNode[Post]: node.node_name, node.instance_name, node.args, node.sub_nodes, node.files ) - def scalar_no_args(self) -> QueryNode[PostSlugString]: + def scalar_no_args(self) -> QueryNode[ScalarString1]: node = selection_to_nodes( {"scalarNoArgs": True}, {"scalarNoArgs": NodeDescs.RootScalarNoArgsFn}, "$q" )[0] @@ -1215,7 +1215,7 @@ def scalar_no_args(self) -> QueryNode[PostSlugString]: def scalar_args( self, args: typing.Union[Post, PlaceholderArgs] - ) -> MutationNode[PostSlugString]: + ) -> MutationNode[ScalarString1]: node = selection_to_nodes( {"scalarArgs": args}, {"scalarArgs": NodeDescs.RootScalarArgsFn}, "$q" )[0] @@ -1235,7 +1235,7 @@ def composite_no_args(self, select: PostSelections) -> MutationNode[Post]: def composite_args( self, - args: typing.Union[RootCompositeArgsFnInput, PlaceholderArgs], + args: typing.Union[ScalarStructShared2, PlaceholderArgs], select: PostSelections, ) -> MutationNode[Post]: node = selection_to_nodes( @@ -1248,7 +1248,7 @@ def composite_args( ) def scalar_union( - self, args: typing.Union[RootCompositeArgsFnInput, PlaceholderArgs] + self, args: typing.Union[ScalarStructShared2, PlaceholderArgs] ) -> QueryNode[RootScalarUnionFnOutput]: node = selection_to_nodes( {"scalarUnion": args}, {"scalarUnion": NodeDescs.RootScalarUnionFn}, "$q" @@ -1259,7 +1259,7 @@ def scalar_union( def composite_union( self, - args: typing.Union[RootCompositeArgsFnInput, PlaceholderArgs], + args: typing.Union[ScalarStructShared2, PlaceholderArgs], select: RootCompositeUnionFnOutputSelections, ) -> QueryNode[RootCompositeUnionFnOutput]: node = selection_to_nodes( @@ -1273,7 +1273,7 @@ def composite_union( def mixed_union( self, - args: typing.Union[RootCompositeArgsFnInput, PlaceholderArgs], + args: typing.Union[ScalarStructShared2, PlaceholderArgs], select: RootMixedUnionFnOutputSelections, ) -> QueryNode[RootMixedUnionFnOutput]: node = selection_to_nodes( diff --git a/tests/metagen/typegraphs/sample/py_upload/client.py b/tests/metagen/typegraphs/sample/py_upload/client.py index 393857a97..1437c33ec 100644 --- a/tests/metagen/typegraphs/sample/py_upload/client.py +++ b/tests/metagen/typegraphs/sample/py_upload/client.py @@ -828,8 +828,8 @@ def RootUploadFn(): sub_nodes=return_node.sub_nodes, variants=return_node.variants, arg_types={ - "file": "RootUploadFnInputFileFile", - "path": "RootUploadFnInputPathRootUploadFnInputPathStringOptional", + "file": "ScalarFileShared1", + "path": "RootUploadFnInputPathScalarString1Optional", }, input_files=[[".file"]], ) @@ -841,64 +841,58 @@ def RootUploadManyFn(): sub_nodes=return_node.sub_nodes, variants=return_node.variants, arg_types={ - "prefix": "RootUploadManyFnInputPrefixRootUploadFnInputPathStringOptional", - "files": "RootUploadManyFnInputFilesRootUploadFnInputFileFileList", + "prefix": "RootUploadManyFnInputPrefixScalarString1Optional", + "files": "RootUploadManyFnInputFilesScalarFileShared1List", }, input_files=[[".files", "[]"]], ) -RootUploadFnInputFileFile = File +ScalarFileShared1 = File -RootUploadFnInputPathString = str +ScalarString1 = str -RootUploadFnInputPathRootUploadFnInputPathStringOptional = typing.Union[ - RootUploadFnInputPathString, None -] +RootUploadFnInputPathScalarString1Optional = typing.Union[ScalarString1, None] RootUploadFnInput = typing.TypedDict( "RootUploadFnInput", { - "file": RootUploadFnInputFileFile, - "path": RootUploadFnInputPathRootUploadFnInputPathStringOptional, + "file": ScalarFileShared1, + "path": RootUploadFnInputPathScalarString1Optional, }, total=False, ) -RootUploadManyFnInputPrefixRootUploadFnInputPathStringOptional = typing.Union[ - RootUploadFnInputPathString, None -] +RootUploadManyFnInputPrefixScalarString1Optional = typing.Union[ScalarString1, None] -RootUploadManyFnInputFilesRootUploadFnInputFileFileList = typing.List[ - RootUploadFnInputFileFile -] +RootUploadManyFnInputFilesScalarFileShared1List = typing.List[ScalarFileShared1] RootUploadManyFnInput = typing.TypedDict( "RootUploadManyFnInput", { - "prefix": RootUploadManyFnInputPrefixRootUploadFnInputPathStringOptional, - "files": RootUploadManyFnInputFilesRootUploadFnInputFileFileList, + "prefix": RootUploadManyFnInputPrefixScalarString1Optional, + "files": RootUploadManyFnInputFilesScalarFileShared1List, }, total=False, ) -RootUploadFnOutput = bool +ScalarBoolean1 = bool class QueryGraph(QueryGraphBase): def __init__(self): super().__init__( { - "RootUploadFnInputFileFile": "root_upload_fn_input_file_file!", - "RootUploadFnInputPathRootUploadFnInputPathStringOptional": "String", - "RootUploadManyFnInputPrefixRootUploadFnInputPathStringOptional": "String", - "RootUploadManyFnInputFilesRootUploadFnInputFileFileList": "[root_upload_fn_input_file_file]!", + "ScalarFileShared1": "scalar_file_shared_1!", + "RootUploadFnInputPathScalarString1Optional": "String", + "RootUploadManyFnInputPrefixScalarString1Optional": "String", + "RootUploadManyFnInputFilesScalarFileShared1List": "[scalar_file_shared_1]!", } ) def upload( self, args: typing.Union[RootUploadFnInput, PlaceholderArgs] - ) -> MutationNode[RootUploadFnOutput]: + ) -> MutationNode[ScalarBoolean1]: node = selection_to_nodes( {"upload": args}, {"upload": NodeDescs.RootUploadFn}, "$q" )[0] @@ -908,7 +902,7 @@ def upload( def upload_many( self, args: typing.Union[RootUploadManyFnInput, PlaceholderArgs] - ) -> MutationNode[RootUploadFnOutput]: + ) -> MutationNode[ScalarBoolean1]: node = selection_to_nodes( {"uploadMany": args}, {"uploadMany": NodeDescs.RootUploadManyFn}, "$q" )[0] diff --git a/tests/metagen/typegraphs/sample/rs/client.rs b/tests/metagen/typegraphs/sample/rs/client.rs index 735fbba47..e45fc4298 100644 --- a/tests/metagen/typegraphs/sample/rs/client.rs +++ b/tests/metagen/typegraphs/sample/rs/client.rs @@ -85,9 +85,9 @@ mod node_metas { NodeMeta { arg_types: Some( [ - ("id".into(), "UserIdStringUuid".into()), - ("slug".into(), "PostSlugString".into()), - ("title".into(), "PostSlugString".into()), + ("id".into(), "ScalarStringUuid1".into()), + ("slug".into(), "ScalarString1".into()), + ("title".into(), "ScalarString1".into()), ].into() ), ..scalar() @@ -102,7 +102,7 @@ mod node_metas { NodeMeta { arg_types: Some( [ - ("id".into(), "PostSlugString".into()), + ("id".into(), "ScalarString1".into()), ].into() ), ..Post() @@ -112,7 +112,7 @@ mod node_metas { NodeMeta { arg_types: Some( [ - ("id".into(), "PostSlugString".into()), + ("id".into(), "ScalarString1".into()), ].into() ), ..scalar() @@ -135,7 +135,7 @@ mod node_metas { NodeMeta { arg_types: Some( [ - ("id".into(), "PostSlugString".into()), + ("id".into(), "ScalarString1".into()), ].into() ), ..RootCompositeUnionFnOutput() @@ -158,7 +158,7 @@ mod node_metas { NodeMeta { arg_types: Some( [ - ("id".into(), "PostSlugString".into()), + ("id".into(), "ScalarString1".into()), ].into() ), ..RootMixedUnionFnOutput() @@ -224,32 +224,32 @@ mod node_metas { } use types::*; pub mod types { - pub type UserIdStringUuid = String; - pub type PostSlugString = String; + pub type ScalarStringUuid1 = String; + pub type ScalarString1 = String; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct PostPartial { - pub id: Option, - pub slug: Option, - pub title: Option, + pub id: Option, + pub slug: Option, + pub title: Option, } #[derive(Debug, serde::Serialize, serde::Deserialize)] - pub struct RootCompositeArgsFnInputPartial { - pub id: Option, + pub struct ScalarStructShared2Partial { + pub id: Option, } - pub type UserEmailStringEmail = String; + pub type ScalarStringEmail1 = String; pub type UserPostsPostList = Vec; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct UserPartial { - pub id: Option, - pub email: Option, + pub id: Option, + pub email: Option, pub posts: Option, } - pub type RootScalarUnionFnOutputT1Integer = i64; + pub type ScalarInteger1 = i64; #[derive(Debug, serde::Serialize, serde::Deserialize)] #[serde(untagged)] pub enum RootScalarUnionFnOutput { - PostSlugString(PostSlugString), - RootScalarUnionFnOutputT1Integer(RootScalarUnionFnOutputT1Integer), + ScalarString1(ScalarString1), + ScalarInteger1(ScalarInteger1), } #[derive(Debug, serde::Serialize, serde::Deserialize)] #[serde(untagged)] @@ -262,26 +262,26 @@ pub mod types { pub enum RootMixedUnionFnOutput { PostPartial(PostPartial), UserPartial(UserPartial), - PostSlugString(PostSlugString), - RootScalarUnionFnOutputT1Integer(RootScalarUnionFnOutputT1Integer), + ScalarString1(ScalarString1), + ScalarInteger1(ScalarInteger1), } #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct RootNestedCompositeFnOutputCompositeStructNestedStructPartial { - pub inner: Option, + pub inner: Option, } #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct RootNestedCompositeFnOutputCompositeStructPartial { - pub value: Option, + pub value: Option, pub nested: Option, } #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct RootNestedCompositeFnOutputListStructPartial { - pub value: Option, + pub value: Option, } pub type RootNestedCompositeFnOutputListRootNestedCompositeFnOutputListStructList = Vec; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct RootNestedCompositeFnOutputPartial { - pub scalar: Option, + pub scalar: Option, pub composite: Option, pub list: Option, } @@ -343,8 +343,8 @@ impl QueryGraph { addr, ty_to_gql_ty_map: std::sync::Arc::new([ - ("UserIdStringUuid".into(), "String!".into()), - ("PostSlugString".into(), "String!".into()), + ("ScalarStringUuid1".into(), "String!".into()), + ("ScalarString1".into(), "String!".into()), ("post".into(), "post!".into()), ("user".into(), "user!".into()), ].into()), @@ -375,7 +375,7 @@ impl QueryGraph { } pub fn scalar_no_args( &self, - ) -> QueryNode + ) -> QueryNode { let nodes = selection_to_node_set( SelectionErasedMap( @@ -396,7 +396,7 @@ impl QueryGraph { pub fn scalar_args( &self, args: impl Into> - ) -> MutationNode + ) -> MutationNode { let nodes = selection_to_node_set( SelectionErasedMap( @@ -427,7 +427,7 @@ impl QueryGraph { } pub fn composite_args( &self, - args: impl Into> + args: impl Into> ) -> UnselectedNode, MutationMarker, PostPartial> { UnselectedNode { @@ -439,7 +439,7 @@ impl QueryGraph { } pub fn scalar_union( &self, - args: impl Into> + args: impl Into> ) -> QueryNode { let nodes = selection_to_node_set( @@ -460,7 +460,7 @@ impl QueryGraph { } pub fn composite_union( &self, - args: impl Into> + args: impl Into> ) -> UnselectedNode, QueryMarker, RootCompositeUnionFnOutput> { UnselectedNode { @@ -472,7 +472,7 @@ impl QueryGraph { } pub fn mixed_union( &self, - args: impl Into> + args: impl Into> ) -> UnselectedNode, QueryMarker, RootMixedUnionFnOutput> { UnselectedNode { diff --git a/tests/metagen/typegraphs/sample/rs/main.rs b/tests/metagen/typegraphs/sample/rs/main.rs index 7735f2f31..d8ba8afc5 100644 --- a/tests/metagen/typegraphs/sample/rs/main.rs +++ b/tests/metagen/typegraphs/sample/rs/main.rs @@ -38,7 +38,7 @@ fn main() -> Result<(), BoxErr> { api1.scalar_args(args.get("post", |val: types::PostPartial| val)), api1.composite_no_args().select(all()), api1.composite_args(args.get("id", |id: String| { - types::RootCompositeArgsFnInputPartial { id: Some(id) } + types::ScalarStructShared2Partial { id: Some(id) } })) .select(all()), ) @@ -98,7 +98,7 @@ fn main() -> Result<(), BoxErr> { title: Some("".into()), }), api1.composite_no_args().select(all()), - api1.composite_args(types::RootCompositeArgsFnInputPartial { + api1.composite_args(types::ScalarStructShared2Partial { id: Some("94be5420-8c4a-4e67-b4f4-e1b2b54832a2".into()), }) .select(all()), @@ -107,11 +107,11 @@ fn main() -> Result<(), BoxErr> { let res5 = gql .query(( - api1.scalar_union(types::RootCompositeArgsFnInputPartial { + api1.scalar_union(types::ScalarStructShared2Partial { id: Some("94be5420-8c4a-4e67-b4f4-e1b2b54832a2".into()), }), // allows ignoring some members - api1.composite_union(types::RootCompositeArgsFnInputPartial { + api1.composite_union(types::ScalarStructShared2Partial { id: Some("94be5420-8c4a-4e67-b4f4-e1b2b54832a2".into()), }) .select(RootCompositeUnionFnOutputSelections { @@ -120,14 +120,14 @@ fn main() -> Result<(), BoxErr> { }), // returns empty if returned type wasn't selected // in union member - api1.composite_union(types::RootCompositeArgsFnInputPartial { + api1.composite_union(types::ScalarStructShared2Partial { id: Some("94be5420-8c4a-4e67-b4f4-e1b2b54832a2".into()), }) .select(RootCompositeUnionFnOutputSelections { user: select(all()), ..default() }), - api1.mixed_union(types::RootCompositeArgsFnInputPartial { + api1.mixed_union(types::ScalarStructShared2Partial { id: Some("94be5420-8c4a-4e67-b4f4-e1b2b54832a2".into()), }) .select(RootMixedUnionFnOutputSelections { diff --git a/tests/metagen/typegraphs/sample/rs_upload/client.rs b/tests/metagen/typegraphs/sample/rs_upload/client.rs index 4b7e6b0ea..c2d8a4fa7 100644 --- a/tests/metagen/typegraphs/sample/rs_upload/client.rs +++ b/tests/metagen/typegraphs/sample/rs_upload/client.rs @@ -42,10 +42,10 @@ mod node_metas { NodeMeta { arg_types: Some( [ - ("file".into(), "RootUploadFnInputFileFile".into()), + ("file".into(), "ScalarFileShared1".into()), ( "path".into(), - "RootUploadFnInputPathRootUploadFnInputPathStringOptional".into(), + "RootUploadFnInputPathScalarString1Optional".into(), ), ] .into(), @@ -62,11 +62,11 @@ mod node_metas { [ ( "prefix".into(), - "RootUploadManyFnInputPrefixRootUploadFnInputPathStringOptional".into(), + "RootUploadManyFnInputPrefixScalarString1Optional".into(), ), ( "files".into(), - "RootUploadManyFnInputFilesRootUploadFnInputFileFileList".into(), + "RootUploadManyFnInputFilesScalarFileShared1List".into(), ), ] .into(), @@ -81,25 +81,22 @@ mod node_metas { } use types::*; pub mod types { - pub type RootUploadFnInputFileFile = super::FileId; - pub type RootUploadFnInputPathString = String; - pub type RootUploadFnInputPathRootUploadFnInputPathStringOptional = - Option; + pub type ScalarFileShared1 = super::FileId; + pub type ScalarString1 = String; + pub type RootUploadFnInputPathScalarString1Optional = Option; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct RootUploadFnInputPartial { - pub file: Option, - pub path: RootUploadFnInputPathRootUploadFnInputPathStringOptional, + pub file: Option, + pub path: RootUploadFnInputPathScalarString1Optional, } - pub type RootUploadManyFnInputPrefixRootUploadFnInputPathStringOptional = - Option; - pub type RootUploadManyFnInputFilesRootUploadFnInputFileFileList = - Vec; + pub type RootUploadManyFnInputPrefixScalarString1Optional = Option; + pub type RootUploadManyFnInputFilesScalarFileShared1List = Vec; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct RootUploadManyFnInputPartial { - pub prefix: RootUploadManyFnInputPrefixRootUploadFnInputPathStringOptional, - pub files: Option, + pub prefix: RootUploadManyFnInputPrefixScalarString1Optional, + pub files: Option, } - pub type RootUploadFnOutput = bool; + pub type ScalarBoolean1 = bool; } impl QueryGraph { @@ -108,21 +105,18 @@ impl QueryGraph { addr, ty_to_gql_ty_map: std::sync::Arc::new( [ + ("ScalarFileShared1".into(), "scalar_file_shared_1!".into()), ( - "RootUploadFnInputFileFile".into(), - "root_upload_fn_input_file_file!".into(), - ), - ( - "RootUploadFnInputPathRootUploadFnInputPathStringOptional".into(), + "RootUploadFnInputPathScalarString1Optional".into(), "String".into(), ), ( - "RootUploadManyFnInputPrefixRootUploadFnInputPathStringOptional".into(), + "RootUploadManyFnInputPrefixScalarString1Optional".into(), "String".into(), ), ( - "RootUploadManyFnInputFilesRootUploadFnInputFileFileList".into(), - "[root_upload_fn_input_file_file]!".into(), + "RootUploadManyFnInputFilesScalarFileShared1List".into(), + "[scalar_file_shared_1]!".into(), ), ] .into(), @@ -133,7 +127,7 @@ impl QueryGraph { pub fn upload( &self, args: impl Into>, - ) -> MutationNode { + ) -> MutationNode { let nodes = selection_to_node_set( SelectionErasedMap( [( @@ -151,7 +145,7 @@ impl QueryGraph { pub fn upload_many( &self, args: impl Into>, - ) -> MutationNode { + ) -> MutationNode { let nodes = selection_to_node_set( SelectionErasedMap( [( diff --git a/tests/metagen/typegraphs/sample/ts/client.ts b/tests/metagen/typegraphs/sample/ts/client.ts index fb796ffe7..0f7e2940a 100644 --- a/tests/metagen/typegraphs/sample/ts/client.ts +++ b/tests/metagen/typegraphs/sample/ts/client.ts @@ -915,9 +915,9 @@ const nodeMetas = { return { ...nodeMetas.scalar(), argumentTypes: { - id: "UserIdStringUuid", - slug: "PostSlugString", - title: "PostSlugString", + id: "ScalarStringUuid1", + slug: "ScalarString1", + title: "ScalarString1", }, }; }, @@ -930,7 +930,7 @@ const nodeMetas = { return { ...nodeMetas.Post(), argumentTypes: { - id: "PostSlugString", + id: "ScalarString1", }, }; }, @@ -938,7 +938,7 @@ const nodeMetas = { return { ...nodeMetas.scalar(), argumentTypes: { - id: "PostSlugString", + id: "ScalarString1", }, }; }, @@ -954,7 +954,7 @@ const nodeMetas = { return { ...nodeMetas.RootCompositeUnionFnOutput(), argumentTypes: { - id: "PostSlugString", + id: "ScalarString1", }, }; }, @@ -970,7 +970,7 @@ const nodeMetas = { return { ...nodeMetas.RootMixedUnionFnOutput(), argumentTypes: { - id: "PostSlugString", + id: "ScalarString1", }, }; }, @@ -1011,48 +1011,48 @@ const nodeMetas = { }; }, }; -export type UserIdStringUuid = string; -export type PostSlugString = string; +export type ScalarStringUuid1 = string; +export type ScalarString1 = string; export type Post = { - id: UserIdStringUuid; - slug: PostSlugString; - title: PostSlugString; + id: ScalarStringUuid1; + slug: ScalarString1; + title: ScalarString1; }; -export type RootCompositeArgsFnInput = { - id: PostSlugString; +export type ScalarStructShared2 = { + id: ScalarString1; }; -export type UserEmailStringEmail = string; +export type ScalarStringEmail1 = string; export type UserPostsPostList = Array; export type User = { - id: UserIdStringUuid; - email: UserEmailStringEmail; + id: ScalarStringUuid1; + email: ScalarStringEmail1; posts: UserPostsPostList; }; -export type RootScalarUnionFnOutputT1Integer = number; +export type ScalarInteger1 = number; export type RootScalarUnionFnOutput = - | (PostSlugString) - | (RootScalarUnionFnOutputT1Integer); + | (ScalarString1) + | (ScalarInteger1); export type RootCompositeUnionFnOutput = | (Post) | (User); export type RootMixedUnionFnOutput = | (Post) | (User) - | (PostSlugString) - | (RootScalarUnionFnOutputT1Integer); + | (ScalarString1) + | (ScalarInteger1); export type RootNestedCompositeFnOutputCompositeStructNestedStruct = { - inner: RootScalarUnionFnOutputT1Integer; + inner: ScalarInteger1; }; export type RootNestedCompositeFnOutputCompositeStruct = { - value: RootScalarUnionFnOutputT1Integer; + value: ScalarInteger1; nested: RootNestedCompositeFnOutputCompositeStructNestedStruct; }; export type RootNestedCompositeFnOutputListStruct = { - value: RootScalarUnionFnOutputT1Integer; + value: ScalarInteger1; }; export type RootNestedCompositeFnOutputListRootNestedCompositeFnOutputListStructList = Array; export type RootNestedCompositeFnOutput = { - scalar: RootScalarUnionFnOutputT1Integer; + scalar: ScalarInteger1; composite: RootNestedCompositeFnOutputCompositeStruct; list: RootNestedCompositeFnOutputListRootNestedCompositeFnOutputListStructList; }; @@ -1102,8 +1102,8 @@ export type RootNestedCompositeFnOutputSelections = { export class QueryGraph extends _QueryGraphBase { constructor() { super({ - "UserIdStringUuid": "String!", - "PostSlugString": "String!", + "ScalarStringUuid1": "String!", + "ScalarString1": "String!", "post": "post!", "user": "user!", }); @@ -1131,7 +1131,7 @@ export class QueryGraph extends _QueryGraphBase { [["scalarNoArgs", nodeMetas.RootScalarNoArgsFn]], "$q", )[0]; - return new QueryNode(inner) as QueryNode; + return new QueryNode(inner) as QueryNode; } scalarArgs(args: Post | PlaceholderArgs) { const inner = _selectionToNodeSet( @@ -1139,7 +1139,7 @@ export class QueryGraph extends _QueryGraphBase { [["scalarArgs", nodeMetas.RootScalarArgsFn]], "$q", )[0]; - return new MutationNode(inner) as MutationNode; + return new MutationNode(inner) as MutationNode; } compositeNoArgs(select: PostSelections) { const inner = _selectionToNodeSet( @@ -1149,7 +1149,7 @@ export class QueryGraph extends _QueryGraphBase { )[0]; return new MutationNode(inner) as MutationNode; } - compositeArgs(args: RootCompositeArgsFnInput | PlaceholderArgs, select: PostSelections) { + compositeArgs(args: ScalarStructShared2 | PlaceholderArgs, select: PostSelections) { const inner = _selectionToNodeSet( { "compositeArgs": [args, select] }, [["compositeArgs", nodeMetas.RootCompositeArgsFn]], @@ -1157,7 +1157,7 @@ export class QueryGraph extends _QueryGraphBase { )[0]; return new MutationNode(inner) as MutationNode; } - scalarUnion(args: RootCompositeArgsFnInput | PlaceholderArgs) { + scalarUnion(args: ScalarStructShared2 | PlaceholderArgs) { const inner = _selectionToNodeSet( { "scalarUnion": args }, [["scalarUnion", nodeMetas.RootScalarUnionFn]], @@ -1165,7 +1165,7 @@ export class QueryGraph extends _QueryGraphBase { )[0]; return new QueryNode(inner) as QueryNode; } - compositeUnion(args: RootCompositeArgsFnInput | PlaceholderArgs, select: RootCompositeUnionFnOutputSelections) { + compositeUnion(args: ScalarStructShared2 | PlaceholderArgs, select: RootCompositeUnionFnOutputSelections) { const inner = _selectionToNodeSet( { "compositeUnion": [args, select] }, [["compositeUnion", nodeMetas.RootCompositeUnionFn]], @@ -1173,7 +1173,7 @@ export class QueryGraph extends _QueryGraphBase { )[0]; return new QueryNode(inner) as QueryNode; } - mixedUnion(args: RootCompositeArgsFnInput | PlaceholderArgs, select: RootMixedUnionFnOutputSelections) { + mixedUnion(args: ScalarStructShared2 | PlaceholderArgs, select: RootMixedUnionFnOutputSelections) { const inner = _selectionToNodeSet( { "mixedUnion": [args, select] }, [["mixedUnion", nodeMetas.RootMixedUnionFn]], diff --git a/tests/metagen/typegraphs/sample/ts_upload/client.ts b/tests/metagen/typegraphs/sample/ts_upload/client.ts index bafdb967b..331729e2d 100644 --- a/tests/metagen/typegraphs/sample/ts_upload/client.ts +++ b/tests/metagen/typegraphs/sample/ts_upload/client.ts @@ -882,8 +882,8 @@ const nodeMetas = { return { ...nodeMetas.scalar(), argumentTypes: { - file: "RootUploadFnInputFileFile", - path: "RootUploadFnInputPathRootUploadFnInputPathStringOptional", + file: "ScalarFileShared1", + path: "RootUploadFnInputPathScalarString1Optional", }, inputFiles: [[".file"]], }; @@ -892,36 +892,36 @@ const nodeMetas = { return { ...nodeMetas.scalar(), argumentTypes: { - prefix: "RootUploadManyFnInputPrefixRootUploadFnInputPathStringOptional", - files: "RootUploadManyFnInputFilesRootUploadFnInputFileFileList", + prefix: "RootUploadManyFnInputPrefixScalarString1Optional", + files: "RootUploadManyFnInputFilesScalarFileShared1List", }, inputFiles: [[".files","[]"]], }; }, }; -export type RootUploadFnInputFileFile = File; -export type RootUploadFnInputPathString = string; -export type RootUploadFnInputPathRootUploadFnInputPathStringOptional = RootUploadFnInputPathString | null | undefined; +export type ScalarFileShared1 = File; +export type ScalarString1 = string; +export type RootUploadFnInputPathScalarString1Optional = ScalarString1 | null | undefined; export type RootUploadFnInput = { - file: RootUploadFnInputFileFile; - path?: RootUploadFnInputPathRootUploadFnInputPathStringOptional; + file: ScalarFileShared1; + path?: RootUploadFnInputPathScalarString1Optional; }; -export type RootUploadManyFnInputPrefixRootUploadFnInputPathStringOptional = RootUploadFnInputPathString | null | undefined; -export type RootUploadManyFnInputFilesRootUploadFnInputFileFileList = Array; +export type RootUploadManyFnInputPrefixScalarString1Optional = ScalarString1 | null | undefined; +export type RootUploadManyFnInputFilesScalarFileShared1List = Array; export type RootUploadManyFnInput = { - prefix?: RootUploadManyFnInputPrefixRootUploadFnInputPathStringOptional; - files: RootUploadManyFnInputFilesRootUploadFnInputFileFileList; + prefix?: RootUploadManyFnInputPrefixScalarString1Optional; + files: RootUploadManyFnInputFilesScalarFileShared1List; }; -export type RootUploadFnOutput = boolean; +export type ScalarBoolean1 = boolean; export class QueryGraph extends _QueryGraphBase { constructor() { super({ - "RootUploadFnInputFileFile": "root_upload_fn_input_file_file!", - "RootUploadFnInputPathRootUploadFnInputPathStringOptional": "String", - "RootUploadManyFnInputPrefixRootUploadFnInputPathStringOptional": "String", - "RootUploadManyFnInputFilesRootUploadFnInputFileFileList": "[root_upload_fn_input_file_file]!", + "ScalarFileShared1": "scalar_file_shared_1!", + "RootUploadFnInputPathScalarString1Optional": "String", + "RootUploadManyFnInputPrefixScalarString1Optional": "String", + "RootUploadManyFnInputFilesScalarFileShared1List": "[scalar_file_shared_1]!", }); } @@ -931,7 +931,7 @@ export class QueryGraph extends _QueryGraphBase { [["upload", nodeMetas.RootUploadFn]], "$q", )[0]; - return new MutationNode(inner) as MutationNode; + return new MutationNode(inner) as MutationNode; } uploadMany(args: RootUploadManyFnInput | PlaceholderArgs) { const inner = _selectionToNodeSet( @@ -939,6 +939,6 @@ export class QueryGraph extends _QueryGraphBase { [["uploadMany", nodeMetas.RootUploadManyFn]], "$q", )[0]; - return new MutationNode(inner) as MutationNode; + return new MutationNode(inner) as MutationNode; } } diff --git a/tests/runtimes/graphql/__snapshots__/graphql_test.ts.snap b/tests/runtimes/graphql/__snapshots__/graphql_test.ts.snap index 4517c2ad0..919086b4f 100644 --- a/tests/runtimes/graphql/__snapshots__/graphql_test.ts.snap +++ b/tests/runtimes/graphql/__snapshots__/graphql_test.ts.snap @@ -65,7 +65,7 @@ snapshot[`Typegraph generation with GraphQL runtime 1`] = ` }, { "type": "string", - "title": "root_user_fn_input_id_string" + "title": "scalar_string_1" }, { "type": "object", @@ -187,7 +187,7 @@ snapshot[`Typegraph generation with GraphQL runtime 1`] = ` }, { "type": "integer", - "title": "message_create_input_id_integer" + "title": "scalar_integer_1" }, { "type": "function", @@ -245,7 +245,7 @@ snapshot[`Typegraph generation with GraphQL runtime 1`] = ` }, { "type": "optional", - "title": "message_create_input_id_message_create_input_id_integer_optional", + "title": "message_create_input_id_scalar_integer_1_optional", "item": 14, "default_value": null }, @@ -417,7 +417,7 @@ snapshot[`Typegraph generation with GraphQL runtime 1`] = ` }, { "type": "list", - "title": "_prisma_integer_filter_t4_struct_in_message_create_input_id_integer_list", + "title": "_prisma_integer_filter_t4_struct_in_scalar_integer_1_list", "items": 14 }, { @@ -516,7 +516,7 @@ snapshot[`Typegraph generation with GraphQL runtime 1`] = ` }, { "type": "list", - "title": "_prisma_string_filter_t3_struct_in_root_user_fn_input_id_string_list", + "title": "_prisma_string_filter_t3_struct_in_scalar_string_1_list", "items": 3 }, { @@ -547,13 +547,13 @@ snapshot[`Typegraph generation with GraphQL runtime 1`] = ` }, { "type": "optional", - "title": "_prisma_string_filter_t5_struct_mode__prisma_string_filter_t5_struct_mode_string_enum_optional", + "title": "_prisma_string_filter_t5_struct_mode_scalar_string_enum_1_optional", "item": 47, "default_value": null }, { "type": "string", - "title": "_prisma_string_filter_t5_struct_mode_string_enum", + "title": "scalar_string_enum_1", "enum": [ "\\\\"insensitive\\\\"" ] @@ -586,7 +586,7 @@ snapshot[`Typegraph generation with GraphQL runtime 1`] = ` }, { "type": "optional", - "title": "_prisma_string_filter_t7_struct_startsWith_root_user_fn_input_id_string_optional", + "title": "_prisma_string_filter_t7_struct_startsWith_scalar_string_1_optional", "item": 3, "default_value": null }, @@ -762,7 +762,7 @@ snapshot[`Typegraph generation with GraphQL runtime 1`] = ` }, { "type": "string", - "title": "message_query_input_distinct_string_enum", + "title": "scalar_string_enum_2", "enum": [ "\\\\"id\\\\"", "\\\\"title\\\\"", diff --git a/tests/runtimes/grpc/__snapshots__/grpc_test.ts.snap b/tests/runtimes/grpc/__snapshots__/grpc_test.ts.snap index c8f82853f..bb958e1a6 100644 --- a/tests/runtimes/grpc/__snapshots__/grpc_test.ts.snap +++ b/tests/runtimes/grpc/__snapshots__/grpc_test.ts.snap @@ -44,13 +44,13 @@ snapshot[`Typegraph using grpc 1`] = ` }, { "type": "optional", - "title": "root_greet_fn_input_name_root_greet_fn_input_name_string_optional", + "title": "scalar_scalar_string_1_optional_shared_1", "item": 4, "default_value": null }, { "type": "string", - "title": "root_greet_fn_input_name_string" + "title": "scalar_string_1" }, { "type": "object", @@ -180,13 +180,13 @@ snapshot[`Typegraph using grpc 2`] = ` }, { "type": "optional", - "title": "root_greet_fn_input_name_root_greet_fn_input_name_string_optional", + "title": "scalar_scalar_string_1_optional_shared_1", "item": 4, "default_value": null }, { "type": "string", - "title": "root_greet_fn_input_name_string" + "title": "scalar_string_1" }, { "type": "object", diff --git a/tests/runtimes/kv/__snapshots__/kv_test.ts.snap b/tests/runtimes/kv/__snapshots__/kv_test.ts.snap index 948e9875a..80856bfa3 100644 --- a/tests/runtimes/kv/__snapshots__/kv_test.ts.snap +++ b/tests/runtimes/kv/__snapshots__/kv_test.ts.snap @@ -52,7 +52,7 @@ snapshot[`Typegraph using kv 1`] = ` }, { "type": "object", - "title": "root_get_fn_input", + "title": "scalar_struct_shared_1", "properties": { "key": 3 }, @@ -64,11 +64,11 @@ snapshot[`Typegraph using kv 1`] = ` }, { "type": "string", - "title": "root_get_fn_input_key_string" + "title": "scalar_string_1" }, { "type": "optional", - "title": "root_get_fn_output", + "title": "scalar_scalar_string_1_optional_shared_1", "item": 3, "default_value": null }, @@ -108,7 +108,7 @@ snapshot[`Typegraph using kv 1`] = ` }, { "type": "integer", - "title": "root_delete_fn_output" + "title": "scalar_integer_1" }, { "type": "function", @@ -122,7 +122,7 @@ snapshot[`Typegraph using kv 1`] = ` }, { "type": "object", - "title": "root_keys_fn_input", + "title": "scalar_struct_shared_2", "properties": { "filter": 4 }, @@ -134,7 +134,7 @@ snapshot[`Typegraph using kv 1`] = ` }, { "type": "list", - "title": "root_keys_fn_output", + "title": "scalar_scalar_string_1_list_shared_1", "items": 3 }, { @@ -304,7 +304,7 @@ snapshot[`Typegraph using kv 2`] = ` }, { "type": "object", - "title": "root_get_fn_input", + "title": "scalar_struct_shared_1", "properties": { "key": 3 }, @@ -316,11 +316,11 @@ snapshot[`Typegraph using kv 2`] = ` }, { "type": "string", - "title": "root_get_fn_input_key_string" + "title": "scalar_string_1" }, { "type": "optional", - "title": "root_get_fn_output", + "title": "scalar_scalar_string_1_optional_shared_1", "item": 3, "default_value": null }, @@ -360,7 +360,7 @@ snapshot[`Typegraph using kv 2`] = ` }, { "type": "integer", - "title": "root_delete_fn_output" + "title": "scalar_integer_1" }, { "type": "function", @@ -374,7 +374,7 @@ snapshot[`Typegraph using kv 2`] = ` }, { "type": "object", - "title": "root_keys_fn_input", + "title": "scalar_struct_shared_2", "properties": { "filter": 4 }, @@ -386,7 +386,7 @@ snapshot[`Typegraph using kv 2`] = ` }, { "type": "list", - "title": "root_keys_fn_output", + "title": "scalar_scalar_string_1_list_shared_1", "items": 3 }, { diff --git a/tests/runtimes/s3/__snapshots__/s3_test.ts.snap b/tests/runtimes/s3/__snapshots__/s3_test.ts.snap index 48f5b3fdc..c00cd315e 100644 --- a/tests/runtimes/s3/__snapshots__/s3_test.ts.snap +++ b/tests/runtimes/s3/__snapshots__/s3_test.ts.snap @@ -63,13 +63,13 @@ snapshot[`s3 typegraphs 1`] = ` }, { "type": "optional", - "title": "root_listObjects_fn_input_path_root_listObjects_fn_input_path_string_optional", + "title": "scalar_scalar_string_1_optional_shared_1", "item": 4, "default_value": null }, { "type": "string", - "title": "root_listObjects_fn_input_path_string" + "title": "scalar_string_1" }, { "type": "object", @@ -106,11 +106,11 @@ snapshot[`s3 typegraphs 1`] = ` }, { "type": "integer", - "title": "root_listObjects_fn_output_keys_struct_size_integer" + "title": "scalar_integer_1" }, { "type": "list", - "title": "root_listObjects_fn_output_prefix_root_listObjects_fn_input_path_string_list", + "title": "root_listObjects_fn_output_prefix_scalar_string_1_list", "items": 4 }, { @@ -137,7 +137,7 @@ snapshot[`s3 typegraphs 1`] = ` }, { "type": "string", - "title": "root_getDownloadUrl_fn_output", + "title": "scalar_string_uri_1", "format": "uri" }, { @@ -197,7 +197,7 @@ snapshot[`s3 typegraphs 1`] = ` }, { "type": "boolean", - "title": "root_upload_fn_output" + "title": "scalar_boolean_1" }, { "type": "function", @@ -225,7 +225,7 @@ snapshot[`s3 typegraphs 1`] = ` }, { "type": "optional", - "title": "root_uploadMany_fn_input_prefix_root_listObjects_fn_input_path_string_optional", + "title": "root_uploadMany_fn_input_prefix_scalar_string_1_optional", "item": 4, "default_value": "" }, diff --git a/tests/runtimes/temporal/__snapshots__/temporal_test.ts.snap b/tests/runtimes/temporal/__snapshots__/temporal_test.ts.snap index acbebcf37..c0d6a032f 100644 --- a/tests/runtimes/temporal/__snapshots__/temporal_test.ts.snap +++ b/tests/runtimes/temporal/__snapshots__/temporal_test.ts.snap @@ -63,11 +63,11 @@ snapshot[`Typegraph using temporal 1`] = ` }, { "type": "string", - "title": "root_start_fn_input_workflow_id_string" + "title": "scalar_string_1" }, { "type": "list", - "title": "root_start_fn_input_args_root_start_fn_input_args_struct_list", + "title": "scalar_root_start_fn_input_args_struct_list_shared_1", "items": 5 }, { @@ -94,7 +94,7 @@ snapshot[`Typegraph using temporal 1`] = ` }, { "type": "object", - "title": "root_query_fn_input", + "title": "scalar_struct_shared_1", "properties": { "workflow_id": 3, "run_id": 3, @@ -130,7 +130,7 @@ snapshot[`Typegraph using temporal 1`] = ` }, { "type": "boolean", - "title": "root_signal_fn_output" + "title": "scalar_boolean_1" }, { "type": "function", @@ -174,13 +174,13 @@ snapshot[`Typegraph using temporal 1`] = ` }, { "type": "optional", - "title": "root_describe_fn_output_start_time_root_describe_fn_output_start_time_integer_optional", + "title": "root_describe_fn_output_start_time_scalar_integer_1_optional", "item": 14, "default_value": null }, { "type": "integer", - "title": "root_describe_fn_output_start_time_integer" + "title": "scalar_integer_1" } ], "materializers": [ @@ -349,7 +349,7 @@ snapshot[`Typegraph using temporal 2`] = ` }, { "type": "string", - "title": "root_startKv_fn_input_workflow_id_string" + "title": "scalar_string_1" }, { "type": "list", @@ -391,7 +391,7 @@ snapshot[`Typegraph using temporal 2`] = ` }, { "type": "list", - "title": "root_query_fn_input_args_root_startKv_fn_input_workflow_id_string_list", + "title": "root_query_fn_input_args_scalar_string_1_list", "items": 3 }, { @@ -447,7 +447,7 @@ snapshot[`Typegraph using temporal 2`] = ` }, { "type": "boolean", - "title": "root_signal_fn_output" + "title": "scalar_boolean_1" }, { "type": "function", @@ -491,13 +491,13 @@ snapshot[`Typegraph using temporal 2`] = ` }, { "type": "optional", - "title": "root_describe_fn_output_start_time_root_describe_fn_output_start_time_integer_optional", + "title": "root_describe_fn_output_start_time_scalar_integer_1_optional", "item": 19, "default_value": null }, { "type": "integer", - "title": "root_describe_fn_output_start_time_integer" + "title": "scalar_integer_1" } ], "materializers": [ diff --git a/tests/runtimes/typegate/__snapshots__/typegate_prisma_test.ts.snap b/tests/runtimes/typegate/__snapshots__/typegate_prisma_test.ts.snap index 3dfa21dad..6c4af12eb 100644 --- a/tests/runtimes/typegate/__snapshots__/typegate_prisma_test.ts.snap +++ b/tests/runtimes/typegate/__snapshots__/typegate_prisma_test.ts.snap @@ -15,7 +15,7 @@ snapshot[`typegate: find available operations 1`] = ` format: "uuid", optional: false, policies: [], - title: "record_with_nested_count_id_string_uuid", + title: "scalar_string_uuid_1", type: "string", }, }, @@ -28,7 +28,7 @@ snapshot[`typegate: find available operations 1`] = ` format: null, optional: false, policies: [], - title: "_prisma_string_filter_t0_string", + title: "scalar_string_1", type: "string", }, }, @@ -41,7 +41,7 @@ snapshot[`typegate: find available operations 1`] = ` format: null, optional: true, policies: [], - title: "_prisma_integer_filter_t0_integer", + title: "scalar_integer_1", type: "integer", }, }, @@ -54,7 +54,7 @@ snapshot[`typegate: find available operations 1`] = ` format: "date-time", optional: false, policies: [], - title: "record_cursor_t3_struct_createdAt_string_datetime", + title: "scalar_string_datetime_2", type: "string", }, }, @@ -73,7 +73,7 @@ snapshot[`typegate: find available operations 1`] = ` format: "uuid", optional: false, policies: [], - title: "record_with_nested_count_id_string_uuid", + title: "scalar_string_uuid_1", type: "string", }, }, @@ -86,7 +86,7 @@ snapshot[`typegate: find available operations 1`] = ` format: null, optional: false, policies: [], - title: "_prisma_string_filter_t0_string", + title: "scalar_string_1", type: "string", }, }, @@ -99,7 +99,7 @@ snapshot[`typegate: find available operations 1`] = ` format: null, optional: true, policies: [], - title: "_prisma_integer_filter_t0_integer", + title: "scalar_integer_1", type: "integer", }, }, @@ -112,7 +112,7 @@ snapshot[`typegate: find available operations 1`] = ` format: "date-time", optional: false, policies: [], - title: "record_cursor_t3_struct_createdAt_string_datetime", + title: "scalar_string_datetime_2", type: "string", }, }, @@ -131,7 +131,7 @@ snapshot[`typegate: find available operations 1`] = ` format: null, optional: false, policies: [], - title: "_prisma_integer_filter_t0_integer", + title: "scalar_integer_1", type: "integer", }, }, @@ -157,7 +157,7 @@ snapshot[`typegate: find available operations 1`] = ` format: null, optional: false, policies: [], - title: "_prisma_string_filter_t0_string", + title: "scalar_string_1", type: "string", }, }, @@ -170,7 +170,7 @@ snapshot[`typegate: find available operations 1`] = ` format: null, optional: false, policies: [], - title: "_prisma_string_filter_t0_string", + title: "scalar_string_1", type: "string", }, }, @@ -202,7 +202,7 @@ snapshot[`typegate: find available operations 1`] = ` format: "uuid", optional: false, policies: [], - title: "record_with_nested_count_id_string_uuid", + title: "scalar_string_uuid_1", type: "string", }, }, @@ -219,7 +219,7 @@ snapshot[`typegate: find available operations 1`] = ` format: null, optional: false, policies: [], - title: "user_identity_create_input_excluding_rel_user_identity_users_provider_string_enum", + title: "scalar_string_enum_3", type: "string", }, }, @@ -232,7 +232,7 @@ snapshot[`typegate: find available operations 1`] = ` format: null, optional: false, policies: [], - title: "_prisma_string_filter_t0_string", + title: "scalar_string_1", type: "string", }, }, @@ -285,7 +285,7 @@ snapshot[`typegate: find available operations 1`] = ` format: null, optional: false, policies: [], - title: "_prisma_integer_filter_t0_integer", + title: "scalar_integer_1", type: "integer", }, }, @@ -298,7 +298,7 @@ snapshot[`typegate: find available operations 1`] = ` format: null, optional: false, policies: [], - title: "_prisma_integer_filter_t0_integer", + title: "scalar_integer_1", type: "integer", }, }, @@ -311,7 +311,7 @@ snapshot[`typegate: find available operations 1`] = ` format: null, optional: false, policies: [], - title: "_prisma_string_filter_t0_string", + title: "scalar_string_1", type: "string", }, }, diff --git a/tests/runtimes/typegate/__snapshots__/typegate_runtime_test.ts.snap b/tests/runtimes/typegate/__snapshots__/typegate_runtime_test.ts.snap index cf9df3a08..69a9313f3 100644 --- a/tests/runtimes/typegate/__snapshots__/typegate_runtime_test.ts.snap +++ b/tests/runtimes/typegate/__snapshots__/typegate_runtime_test.ts.snap @@ -32,7 +32,7 @@ snapshot[`typegate: find available operations 1`] = ` enum: null, format: "uuid", optional: false, - title: "record_with_nested_count_id_string_uuid", + title: "scalar_string_uuid_1", type: "string", }, }, @@ -45,7 +45,7 @@ snapshot[`typegate: find available operations 1`] = ` enum: null, format: null, optional: false, - title: "_prisma_string_filter_t0_string", + title: "scalar_string_1", type: "string", }, }, @@ -58,7 +58,7 @@ snapshot[`typegate: find available operations 1`] = ` enum: null, format: null, optional: true, - title: "_prisma_integer_filter_t0_integer", + title: "scalar_integer_1", type: "integer", }, }, @@ -71,7 +71,7 @@ snapshot[`typegate: find available operations 1`] = ` enum: null, format: "date-time", optional: false, - title: "record_with_nested_count_createdAt_string_datetime", + title: "scalar_string_datetime_1", type: "string", }, }, @@ -175,7 +175,7 @@ snapshot[`typegate: find available operations 1`] = ` enum: null, format: "uuid", optional: false, - title: "record_with_nested_count_id_string_uuid", + title: "scalar_string_uuid_1", type: "string", }, }, @@ -188,7 +188,7 @@ snapshot[`typegate: find available operations 1`] = ` enum: null, format: null, optional: false, - title: "_prisma_string_filter_t0_string", + title: "scalar_string_1", type: "string", }, }, @@ -201,7 +201,7 @@ snapshot[`typegate: find available operations 1`] = ` enum: null, format: null, optional: true, - title: "_prisma_integer_filter_t0_integer", + title: "scalar_integer_1", type: "integer", }, }, @@ -214,7 +214,7 @@ snapshot[`typegate: find available operations 1`] = ` enum: null, format: "date-time", optional: false, - title: "record_with_nested_count_createdAt_string_datetime", + title: "scalar_string_datetime_1", type: "string", }, }, @@ -253,7 +253,7 @@ snapshot[`typegate: find available operations 1`] = ` enum: null, format: null, optional: false, - title: "_prisma_integer_filter_t0_integer", + title: "scalar_integer_1", type: "integer", }, }, @@ -279,7 +279,7 @@ snapshot[`typegate: find available operations 1`] = ` enum: null, format: null, optional: false, - title: "_prisma_string_filter_t0_string", + title: "scalar_string_1", type: "string", }, }, @@ -292,7 +292,7 @@ snapshot[`typegate: find available operations 1`] = ` enum: null, format: null, optional: false, - title: "_prisma_string_filter_t0_string", + title: "scalar_string_1", type: "string", }, }, @@ -319,7 +319,7 @@ snapshot[`typegate: find available operations 1`] = ` enum: null, format: null, optional: true, - title: "_prisma_integer_filter_t0_integer", + title: "scalar_integer_1", type: "integer", }, }, @@ -333,7 +333,7 @@ snapshot[`typegate: find available operations 1`] = ` enum: null, format: null, optional: true, - title: "_prisma_integer_filter_t0_integer", + title: "scalar_integer_1", type: "integer", }, }, @@ -437,7 +437,7 @@ snapshot[`typegate: find available operations 1`] = ` enum: null, format: null, optional: false, - title: "_prisma_integer_filter_t0_integer", + title: "scalar_integer_1", type: "integer", }, }, @@ -450,7 +450,7 @@ snapshot[`typegate: find available operations 1`] = ` enum: null, format: null, optional: false, - title: "_prisma_integer_filter_t0_integer", + title: "scalar_integer_1", type: "integer", }, }, @@ -463,7 +463,7 @@ snapshot[`typegate: find available operations 1`] = ` enum: null, format: null, optional: false, - title: "_prisma_string_filter_t0_string", + title: "scalar_string_1", type: "string", }, }, @@ -477,7 +477,7 @@ snapshot[`typegate: find available operations 1`] = ` enum: null, format: null, optional: false, - title: "_prisma_integer_filter_t0_integer", + title: "scalar_integer_1", type: "integer", }, }, @@ -505,7 +505,7 @@ snapshot[`typegate: find available operations 1`] = ` enum: null, format: null, optional: false, - title: "_prisma_string_filter_t0_string", + title: "scalar_string_1", type: "string", }, }, @@ -519,7 +519,7 @@ snapshot[`typegate: find available operations 1`] = ` enum: null, format: null, optional: false, - title: "_prisma_string_filter_t0_string", + title: "scalar_string_1", type: "string", }, }, diff --git a/tests/runtimes/wasm_reflected/rust/Cargo.lock b/tests/runtimes/wasm_reflected/rust/Cargo.lock index d6b3aeef1..41f34e0ab 100644 --- a/tests/runtimes/wasm_reflected/rust/Cargo.lock +++ b/tests/runtimes/wasm_reflected/rust/Cargo.lock @@ -114,7 +114,7 @@ dependencies = [ [[package]] name = "rust" -version = "0.5.0-rc.7" +version = "0.5.0-rc.9" dependencies = [ "wit-bindgen", ] diff --git a/tests/runtimes/wasm_wire/rust/fdk.rs b/tests/runtimes/wasm_wire/rust/fdk.rs index 7cd94e752..3b80916fe 100644 --- a/tests/runtimes/wasm_wire/rust/fdk.rs +++ b/tests/runtimes/wasm_wire/rust/fdk.rs @@ -109,7 +109,7 @@ impl Router { } pub fn init(&self, args: InitArgs) -> Result { - static MT_VERSION: &str = "0.5.0-rc.8"; + static MT_VERSION: &str = "0.5.0-rc.9"; if args.metatype_version != MT_VERSION { return Err(InitError::VersionMismatch(MT_VERSION.into())); } @@ -219,53 +219,53 @@ macro_rules! init_mat { // gen-static-end use types::*; pub mod types { - pub type AddArgsAFloat = f64; + pub type ScalarFloat1 = f64; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct AddArgs { - pub a: AddArgsAFloat, - pub b: AddArgsAFloat, + pub a: ScalarFloat1, + pub b: ScalarFloat1, } - pub type AddOutput = i64; - pub type RangeArgsAAddOutputOptional = Option; + pub type ScalarInteger1 = i64; + pub type RangeArgsAScalarInteger1Optional = Option; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct RangeArgs { - pub a: RangeArgsAAddOutputOptional, - pub b: AddOutput, + pub a: RangeArgsAScalarInteger1Optional, + pub b: ScalarInteger1, } - pub type RangeOutput = Vec; + pub type RangeOutput = Vec; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct RecordCreationInput { } - pub type EntityNameString = String; - pub type ProfileLevelStringEnum = String; - pub type ProfileAttributesStringEnum = String; - pub type ProfileAttributesProfileAttributesStringEnumList = Vec; - pub type ProfileCategoryStructTagStringEnum = String; - pub type ProfileCategoryStructValueEntityNameStringOptional = Option; + pub type ScalarString1 = String; + pub type ScalarStringEnum1 = String; + pub type ScalarStringEnum2 = String; + pub type ProfileAttributesScalarStringEnum2List = Vec; + pub type ScalarStringEnum3 = String; + pub type ProfileCategoryStructValueScalarString1Optional = Option; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct ProfileCategoryStruct { - pub tag: ProfileCategoryStructTagStringEnum, - pub value: ProfileCategoryStructValueEntityNameStringOptional, + pub tag: ScalarStringEnum3, + pub value: ProfileCategoryStructValueScalarString1Optional, } #[derive(Debug, serde::Serialize, serde::Deserialize)] #[serde(untagged)] pub enum ProfileMetadatasEither { - EntityNameString(EntityNameString), - AddArgsAFloat(AddArgsAFloat), + ScalarString1(ScalarString1), + ScalarFloat1(ScalarFloat1), } pub type ProfileMetadatasProfileMetadatasEitherList = Vec; pub type ProfileMetadatasProfileMetadatasProfileMetadatasEitherListList = Vec; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct Profile { - pub level: ProfileLevelStringEnum, - pub attributes: ProfileAttributesProfileAttributesStringEnumList, + pub level: ScalarStringEnum1, + pub attributes: ProfileAttributesScalarStringEnum2List, pub category: ProfileCategoryStruct, pub metadatas: ProfileMetadatasProfileMetadatasProfileMetadatasEitherListList, } #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct Entity { - pub name: EntityNameString, - pub age: RangeArgsAAddOutputOptional, + pub name: ScalarString1, + pub age: RangeArgsAScalarInteger1Optional, pub profile: Profile, } pub type RecordCreationOutput = Vec; @@ -290,7 +290,7 @@ pub mod stubs { } } - fn handle(&self, input: AddArgs, cx: Ctx) -> anyhow::Result; + fn handle(&self, input: AddArgs, cx: Ctx) -> anyhow::Result; } pub trait Range: Sized + 'static { fn erased(self) -> ErasedHandler { From eedf3101f8cdf336d6d81f444cf20366c2807c7e Mon Sep 17 00:00:00 2001 From: michael-0acf4 Date: Fri, 10 Jan 2025 17:59:53 +0300 Subject: [PATCH 4/4] feat: use hash --- examples/typegraphs/metagen/rs/fdk.rs | 14 +- .../src/typegraphs/introspection.json | 8 +- src/typegate/src/typegraphs/typegate.json | 36 ++-- ...core__tests__successful_serialization.snap | 10 +- .../core/src/utils/postprocess/naming.rs | 41 ++-- .../__snapshots__/typegraph_test.ts.snap | 60 +++--- .../__snapshots__/metagen_test.ts.snap | 204 +++++++++--------- tests/metagen/typegraphs/identities/rs/fdk.rs | 78 +++---- tests/metagen/typegraphs/identities/ts/fdk.ts | 78 +++---- tests/metagen/typegraphs/sample/py/client.py | 72 +++---- .../typegraphs/sample/py_upload/client.py | 40 ++-- tests/metagen/typegraphs/sample/rs/client.rs | 66 +++--- tests/metagen/typegraphs/sample/rs/main.rs | 14 +- .../typegraphs/sample/rs_upload/client.rs | 40 ++-- tests/metagen/typegraphs/sample/ts/client.ts | 66 +++--- .../typegraphs/sample/ts_upload/client.ts | 38 ++-- .../__snapshots__/planner_test.ts.snap | 114 +++++----- .../__snapshots__/graphql_test.ts.snap | 18 +- .../grpc/__snapshots__/grpc_test.ts.snap | 8 +- .../runtimes/kv/__snapshots__/kv_test.ts.snap | 24 +-- .../runtimes/s3/__snapshots__/s3_test.ts.snap | 14 +- .../__snapshots__/temporal_test.ts.snap | 22 +- .../typegate_prisma_test.ts.snap | 34 +-- .../typegate_runtime_test.ts.snap | 38 ++-- tests/runtimes/wasm_wire/rust/fdk.rs | 46 ++-- 25 files changed, 578 insertions(+), 605 deletions(-) diff --git a/examples/typegraphs/metagen/rs/fdk.rs b/examples/typegraphs/metagen/rs/fdk.rs index 2d575f711..e6c756fe3 100644 --- a/examples/typegraphs/metagen/rs/fdk.rs +++ b/examples/typegraphs/metagen/rs/fdk.rs @@ -219,17 +219,17 @@ macro_rules! init_mat { // gen-static-end use types::*; pub mod types { - pub type ScalarString1 = String; - pub type ScalarStringDatetime1 = String; - pub type ScalarStringUri1 = String; + pub type Idv3TitleString = String; + pub type Idv3ReleaseTimeStringDatetime = String; + pub type Idv3Mp3UrlStringUri = String; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct Idv3 { - pub title: ScalarString1, - pub artist: ScalarString1, + pub title: Idv3TitleString, + pub artist: Idv3TitleString, #[serde(rename = "releaseTime")] - pub release_time: ScalarStringDatetime1, + pub release_time: Idv3ReleaseTimeStringDatetime, #[serde(rename = "mp3Url")] - pub mp3_url: ScalarStringUri1, + pub mp3_url: Idv3Mp3UrlStringUri, } } pub mod stubs { diff --git a/src/typegate/src/typegraphs/introspection.json b/src/typegate/src/typegraphs/introspection.json index eee6c5491..66947140e 100644 --- a/src/typegate/src/typegraphs/introspection.json +++ b/src/typegate/src/typegraphs/introspection.json @@ -45,7 +45,7 @@ }, { "type": "string", - "title": "scalar_string_1" + "title": "root___type_fn_input_name_string" }, { "type": "optional", @@ -99,7 +99,7 @@ }, { "type": "optional", - "title": "type_name_scalar_string_1_optional", + "title": "type_name_root___type_fn_input_name_string_optional", "item": 3, "default_value": null }, @@ -127,13 +127,13 @@ }, { "type": "optional", - "title": "type_fields_fn_input_includeDeprecated_scalar_boolean_1_optional", + "title": "type_fields_fn_input_includeDeprecated_type_fields_fn_input_includeDeprecated_boolean_optional", "item": 11, "default_value": null }, { "type": "boolean", - "title": "scalar_boolean_1" + "title": "type_fields_fn_input_includeDeprecated_boolean" }, { "type": "optional", diff --git a/src/typegate/src/typegraphs/typegate.json b/src/typegate/src/typegraphs/typegate.json index aab573549..9ebbd6463 100644 --- a/src/typegate/src/typegraphs/typegate.json +++ b/src/typegate/src/typegraphs/typegate.json @@ -83,7 +83,7 @@ }, { "type": "object", - "title": "scalar_struct_shared_1", + "title": "struct_542d7", "properties": {}, "id": [], "required": [] @@ -109,11 +109,11 @@ }, { "type": "string", - "title": "scalar_string_1" + "title": "string_5d176" }, { "type": "string", - "title": "scalar_string_uri_1", + "title": "Typegraph_url_string_uri", "format": "uri" }, { @@ -198,7 +198,7 @@ }, { "type": "string", - "title": "scalar_string_json_1", + "title": "string_json_df54e", "format": "json" }, { @@ -240,7 +240,7 @@ }, { "type": "string", - "title": "scalar_string_enum_1", + "title": "root_addTypegraph_fn_output_messages_struct_type_string_enum", "enum": [ "\"info\"", "\"warning\"", @@ -268,7 +268,7 @@ }, { "type": "optional", - "title": "root_addTypegraph_fn_output_failure_scalar_string_json_1_optional", + "title": "root_addTypegraph_fn_output_failure_string_json_df54e_optional", "item": 14, "default_value": null }, @@ -296,12 +296,12 @@ }, { "type": "list", - "title": "scalar_scalar_string_1_list_shared_1", + "title": "string_5d176_list_691ee", "items": 5 }, { "type": "boolean", - "title": "scalar_boolean_1" + "title": "boolean_a56cd" }, { "type": "function", @@ -333,7 +333,7 @@ }, { "type": "list", - "title": "root_argInfoByPath_fn_input_argPaths_scalar_scalar_string_1_list_shared_1_list", + "title": "root_argInfoByPath_fn_input_argPaths_string_5d176_list_691ee_list", "items": 24 }, { @@ -369,18 +369,18 @@ }, { "type": "optional", - "title": "TypeInfo_enum_TypeInfo_enum_scalar_string_json_1_list_optional", + "title": "TypeInfo_enum_TypeInfo_enum_string_json_df54e_list_optional", "item": 32, "default_value": null }, { "type": "list", - "title": "TypeInfo_enum_scalar_string_json_1_list", + "title": "TypeInfo_enum_string_json_df54e_list", "items": 14 }, { "type": "optional", - "title": "TypeInfo_format_scalar_string_1_optional", + "title": "TypeInfo_format_string_5d176_optional", "item": 5, "default_value": null }, @@ -440,7 +440,7 @@ }, { "type": "object", - "title": "scalar_struct_shared_2", + "title": "struct_8f8a3", "properties": { "typegraph": 5 }, @@ -477,7 +477,7 @@ }, { "type": "string", - "title": "scalar_string_enum_2", + "title": "OperationInfo_type_string_enum", "enum": [ "\"query\"", "\"mutation\"" @@ -596,7 +596,7 @@ }, { "type": "object", - "title": "scalar_struct_shared_3", + "title": "struct_5fa3d", "properties": { "typegraph": 5, "runtime": 5, @@ -697,13 +697,13 @@ }, { "type": "optional", - "title": "PrismaBatchQuery_transaction_struct_isolationLevel_scalar_string_enum_3_optional", + "title": "PrismaBatchQuery_transaction_struct_isolationLevel_PrismaBatchQuery_transaction_struct_isolationLevel_string_enum_optional", "item": 63, "default_value": null }, { "type": "string", - "title": "scalar_string_enum_3", + "title": "PrismaBatchQuery_transaction_struct_isolationLevel_string_enum", "enum": [ "\"read uncommitted\"", "\"readuncommitted\"", @@ -777,7 +777,7 @@ }, { "type": "integer", - "title": "scalar_integer_1" + "title": "integer_e116e" }, { "type": "object", diff --git a/src/typegraph/core/src/snapshots/typegraph_core__tests__successful_serialization.snap b/src/typegraph/core/src/snapshots/typegraph_core__tests__successful_serialization.snap index 472071a44..f8e5b2a0d 100644 --- a/src/typegraph/core/src/snapshots/typegraph_core__tests__successful_serialization.snap +++ b/src/typegraph/core/src/snapshots/typegraph_core__tests__successful_serialization.snap @@ -43,28 +43,28 @@ expression: typegraph.0 }, { "type": "integer", - "title": "scalar_integer_1" + "title": "root_one_fn_input_one_integer" }, { "type": "integer", - "title": "scalar_integer_2", + "title": "integer_f0e37", "minimum": 12, "maximum": 44 }, { "type": "optional", - "title": "root_one_fn_input_three_root_one_fn_input_three_scalar_float_1_list_optional", + "title": "root_one_fn_input_three_root_one_fn_input_three_root_one_fn_input_three_float_list_optional", "item": 6, "default_value": null }, { "type": "list", - "title": "root_one_fn_input_three_scalar_float_1_list", + "title": "root_one_fn_input_three_root_one_fn_input_three_float_list", "items": 7 }, { "type": "float", - "title": "scalar_float_1" + "title": "root_one_fn_input_three_float" } ], "materializers": [ diff --git a/src/typegraph/core/src/utils/postprocess/naming.rs b/src/typegraph/core/src/utils/postprocess/naming.rs index 07295b279..d3d575282 100644 --- a/src/typegraph/core/src/utils/postprocess/naming.rs +++ b/src/typegraph/core/src/utils/postprocess/naming.rs @@ -11,6 +11,7 @@ use common::typegraph::{ StringFormat, TypeNode, Typegraph, }; use indexmap::IndexSet; +use sha2::{Digest, Sha256}; use crate::errors::TgError; @@ -46,7 +47,6 @@ impl super::PostProcessor for NamingProcessor { path: vec![], // ref related counts: ref_counters.counts, - name_occurences: Default::default(), }; for (key, &ty_id) in &root_data.properties { acc.path.push(( @@ -76,7 +76,6 @@ struct VisitCollector { path: Vec<(PathSegment, Rc)>, // ref related counts: HashMap>, - name_occurences: HashMap, } struct TypeRefCount { @@ -103,17 +102,12 @@ impl VisitCollector { false } - pub fn next_name(&mut self, name: String) -> String { - // Hopefully more stable than ids on snapshots - format!( - "scalar_{name}_{}", - self.name_occurences - .entry(name.clone()) - .and_modify(|counter| { - *counter += 1; - }) - .or_insert(1) - ) + pub fn next_name(&mut self, name: String, hash_input: String) -> String { + let mut sha256 = Sha256::new(); + sha256.update(hash_input.bytes().collect::>()); + let hash = format!("{:x}", sha256.finalize()); + + format!("{name}_{}", hash.chars().take(5).collect::()) } } @@ -338,16 +332,15 @@ fn gen_name(cx: &VisitContext, acc: &mut VisitCollector, id: u32, ty_name: &str) let node = &cx.tg.types[id as usize]; let name: Rc = if cx.user_named.contains(&id) { node.base().title.clone().into() - } else if node.is_scalar() { - acc.next_name(ty_name.to_string()).into() } else { - macro_rules! use_if_ok { - ($default:expr) => { + macro_rules! join_if_ok { + ($prefix:expr, $default:expr) => { if acc.has_more_than_one_referrer(id) { // Cannot be opinionated on the prefix path if shared (confusing) - acc.next_name(format!("{ty_name}_shared")).into() + let hash_input = $prefix; + acc.next_name(ty_name.to_string(), hash_input) } else { - $default + format!("{}_{}", $prefix, $default) } }; } @@ -361,11 +354,13 @@ fn gen_name(cx: &VisitContext, acc: &mut VisitCollector, id: u32, ty_name: &str) // we don't include optional and list nodes in // generated names (useless but also, they might be placeholders) Edge::OptionalItem | Edge::ArrayItem => continue, - Edge::FunctionInput => use_if_ok!(format!("{last_name}_input")), - Edge::FunctionOutput => use_if_ok!(format!("{last_name}_output")), - Edge::ObjectProp(key) => use_if_ok!(format!("{last_name}_{key}_{ty_name}")), + Edge::FunctionInput => join_if_ok!(last_name.to_string(), "input"), + Edge::FunctionOutput => join_if_ok!(last_name.to_string(), "output"), + Edge::ObjectProp(key) => { + join_if_ok!(format!("{last_name}_{key}"), ty_name) + } Edge::EitherVariant(idx) | Edge::UnionVariant(idx) => { - use_if_ok!(format!("{last_name}_t{idx}_{ty_name}")) + join_if_ok!(format!("{last_name}_t{idx}"), ty_name) } }; break; diff --git a/tests/e2e/typegraph/__snapshots__/typegraph_test.ts.snap b/tests/e2e/typegraph/__snapshots__/typegraph_test.ts.snap index 42ff6dc34..782d9a47d 100644 --- a/tests/e2e/typegraph/__snapshots__/typegraph_test.ts.snap +++ b/tests/e2e/typegraph/__snapshots__/typegraph_test.ts.snap @@ -60,17 +60,17 @@ snapshot[`typegraphs creation 1`] = ` }, { "type": "string", - "title": "scalar_string_1" + "title": "ComplexType_a_string_string" }, { "type": "float", - "title": "scalar_float_1", + "title": "ComplexType_a_float_float", "minimum": 1.0, "multipleOf": 2.0 }, { "type": "string", - "title": "scalar_string_enum_1", + "title": "ComplexType_an_enum_string_enum", "enum": [ "\\\\"one\\\\"", "\\\\"two\\\\"" @@ -78,7 +78,7 @@ snapshot[`typegraphs creation 1`] = ` }, { "type": "integer", - "title": "scalar_integer_enum_1", + "title": "ComplexType_an_integer_enum_integer_enum", "enum": [ "1", "2" @@ -86,7 +86,7 @@ snapshot[`typegraphs creation 1`] = ` }, { "type": "float", - "title": "scalar_float_2", + "title": "ComplexType_a_float_enum_float", "enum": [ "1.5", "2.5" @@ -106,7 +106,7 @@ snapshot[`typegraphs creation 1`] = ` }, { "type": "float", - "title": "scalar_float_3" + "title": "ComplexType_a_struct_struct_value_float" }, { "type": "optional", @@ -129,7 +129,7 @@ snapshot[`typegraphs creation 1`] = ` }, { "type": "integer", - "title": "scalar_integer_1" + "title": "ComplexType_nested_either_t1_integer" }, { "type": "object", @@ -159,12 +159,12 @@ snapshot[`typegraphs creation 1`] = ` }, { "type": "string", - "title": "scalar_string_email_1", + "title": "ComplexType_an_email_string_email", "format": "email" }, { "type": "boolean", - "title": "scalar_boolean_1" + "title": "root_test_fn_output" } ], "materializers": [ @@ -302,7 +302,7 @@ snapshot[`typegraphs creation 2`] = ` }, { "type": "object", - "title": "scalar_struct_shared_1", + "title": "struct_aada4", "properties": { "first": 3, "second": 3 @@ -316,7 +316,7 @@ snapshot[`typegraphs creation 2`] = ` }, { "type": "float", - "title": "scalar_float_1" + "title": "float_9d392" }, { "type": "function", @@ -454,7 +454,7 @@ snapshot[`typegraphs creation 3`] = ` }, { "type": "object", - "title": "scalar_struct_shared_1", + "title": "struct_62ec9", "properties": { "a": 3, "b": 4 @@ -468,16 +468,16 @@ snapshot[`typegraphs creation 3`] = ` }, { "type": "integer", - "title": "scalar_integer_1" + "title": "struct_62ec9_a_integer" }, { "type": "integer", - "title": "scalar_integer_2", + "title": "struct_62ec9_b_integer", "minimum": 12 }, { "type": "integer", - "title": "scalar_integer_3", + "title": "root_one_fn_output", "minimum": 12, "maximum": 43 }, @@ -729,17 +729,17 @@ snapshot[`typegraphs creation 4`] = ` }, { "type": "string", - "title": "scalar_string_1" + "title": "ComplexType_a_string_string" }, { "type": "float", - "title": "scalar_float_1", + "title": "ComplexType_a_float_float", "minimum": 1.0, "multipleOf": 2.0 }, { "type": "string", - "title": "scalar_string_enum_1", + "title": "ComplexType_an_enum_string_enum", "enum": [ "\\\\"one\\\\"", "\\\\"two\\\\"" @@ -747,7 +747,7 @@ snapshot[`typegraphs creation 4`] = ` }, { "type": "integer", - "title": "scalar_integer_enum_1", + "title": "ComplexType_an_integer_enum_integer_enum", "enum": [ "1", "2" @@ -755,7 +755,7 @@ snapshot[`typegraphs creation 4`] = ` }, { "type": "float", - "title": "scalar_float_2", + "title": "ComplexType_a_float_enum_float", "enum": [ "1.5", "2.5" @@ -775,7 +775,7 @@ snapshot[`typegraphs creation 4`] = ` }, { "type": "float", - "title": "scalar_float_3" + "title": "ComplexType_a_struct_struct_value_float" }, { "type": "optional", @@ -798,7 +798,7 @@ snapshot[`typegraphs creation 4`] = ` }, { "type": "integer", - "title": "scalar_integer_1" + "title": "ComplexType_nested_either_t1_integer" }, { "type": "object", @@ -828,12 +828,12 @@ snapshot[`typegraphs creation 4`] = ` }, { "type": "string", - "title": "scalar_string_email_1", + "title": "ComplexType_an_email_string_email", "format": "email" }, { "type": "boolean", - "title": "scalar_boolean_1" + "title": "root_test_fn_output" } ], "materializers": [ @@ -971,7 +971,7 @@ snapshot[`typegraphs creation 5`] = ` }, { "type": "object", - "title": "scalar_struct_shared_1", + "title": "struct_aada4", "properties": { "first": 3, "second": 3 @@ -985,7 +985,7 @@ snapshot[`typegraphs creation 5`] = ` }, { "type": "float", - "title": "scalar_float_1" + "title": "float_9d392" }, { "type": "function", @@ -1123,7 +1123,7 @@ snapshot[`typegraphs creation 6`] = ` }, { "type": "object", - "title": "scalar_struct_shared_1", + "title": "struct_62ec9", "properties": { "a": 3, "b": 4 @@ -1137,16 +1137,16 @@ snapshot[`typegraphs creation 6`] = ` }, { "type": "integer", - "title": "scalar_integer_1" + "title": "struct_62ec9_a_integer" }, { "type": "integer", - "title": "scalar_integer_2", + "title": "struct_62ec9_b_integer", "minimum": 12 }, { "type": "integer", - "title": "scalar_integer_3", + "title": "root_one_fn_output", "minimum": 12, "maximum": 43 }, diff --git a/tests/metagen/__snapshots__/metagen_test.ts.snap b/tests/metagen/__snapshots__/metagen_test.ts.snap index 3e1fa9f72..99f9dd69a 100644 --- a/tests/metagen/__snapshots__/metagen_test.ts.snap +++ b/tests/metagen/__snapshots__/metagen_test.ts.snap @@ -91,11 +91,11 @@ class Struct: @dataclass -class ScalarStructShared1(Struct): +class Struct62ec9(Struct): name: str -FORWARD_REFS["ScalarStructShared1"] = ScalarStructShared1 +FORWARD_REFS["Struct62ec9"] = Struct62ec9 @dataclass @@ -116,9 +116,9 @@ def __repr(value: Any): -def typed_three(user_fn: Callable[[ScalarStructShared1, Ctx], Student]): +def typed_three(user_fn: Callable[[Struct62ec9, Ctx], Student]): def exported_wrapper(raw_inp, ctx): - inp: ScalarStructShared1 = Struct.new(ScalarStructShared1, raw_inp) + inp: Struct62ec9 = Struct.new(Struct62ec9, raw_inp) out: Student = user_fn(inp, ctx) if isinstance(out, list): return [__repr(v) for v in out] @@ -136,11 +136,11 @@ def typed_three(user_fn: Callable[[ScalarStructShared1, Ctx], Student]): # are supported. I.e. prefixed by \`.\` or \`..\` # - Make sure to include any module imports in the \`deps\` # array when using external modules with PythonRuntime -from .other_types import ScalarStructShared1, Student, typed_three +from .other_types import Struct62ec9, Student, typed_three @typed_three -def three(inp: ScalarStructShared1, ctx: Ctx) -> Student: +def three(inp: Struct62ec9, ctx: Ctx) -> Student: # TODO: write your logic here raise Exception("three not implemented") @@ -237,11 +237,11 @@ class Struct: @dataclass -class ScalarStructShared1(Struct): +class Struct62ec9(Struct): name: str -FORWARD_REFS["ScalarStructShared1"] = ScalarStructShared1 +FORWARD_REFS["Struct62ec9"] = Struct62ec9 @dataclass @@ -263,7 +263,7 @@ FORWARD_REFS["TwoInput"] = TwoInput TypeRootOneFnOutput = List["Student"] -TypeScalarString1 = str +TypeString5fd9b = str def __repr(value: Any): if isinstance(value, Struct): @@ -272,9 +272,9 @@ def __repr(value: Any): -def typed_fnOne(user_fn: Callable[[ScalarStructShared1, Ctx], TypeRootOneFnOutput]): +def typed_fnOne(user_fn: Callable[[Struct62ec9, Ctx], TypeRootOneFnOutput]): def exported_wrapper(raw_inp, ctx): - inp: ScalarStructShared1 = Struct.new(ScalarStructShared1, raw_inp) + inp: Struct62ec9 = Struct.new(Struct62ec9, raw_inp) out: TypeRootOneFnOutput = user_fn(inp, ctx) if isinstance(out, list): return [__repr(v) for v in out] @@ -283,10 +283,10 @@ def typed_fnOne(user_fn: Callable[[ScalarStructShared1, Ctx], TypeRootOneFnOutpu return exported_wrapper -def typed_fnTwo(user_fn: Callable[[TwoInput, Ctx], TypeScalarString1]): +def typed_fnTwo(user_fn: Callable[[TwoInput, Ctx], TypeString5fd9b]): def exported_wrapper(raw_inp, ctx): inp: TwoInput = Struct.new(TwoInput, raw_inp) - out: TypeScalarString1 = user_fn(inp, ctx) + out: TypeString5fd9b = user_fn(inp, ctx) if isinstance(out, list): return [__repr(v) for v in out] return __repr(out) @@ -303,16 +303,16 @@ def typed_fnTwo(user_fn: Callable[[TwoInput, Ctx], TypeScalarString1]): # are supported. I.e. prefixed by \`.\` or \`..\` # - Make sure to include any module imports in the \`deps\` # array when using external modules with PythonRuntime -from .same_hit_types import ScalarStructShared1, TwoInput, TypeRootOneFnOutput, TypeScalarString1, typed_fnOne, typed_fnTwo +from .same_hit_types import Struct62ec9, TwoInput, TypeRootOneFnOutput, TypeString5fd9b, typed_fnOne, typed_fnTwo @typed_fnOne -def fnOne(inp: ScalarStructShared1, ctx: Ctx) -> TypeRootOneFnOutput: +def fnOne(inp: Struct62ec9, ctx: Ctx) -> TypeRootOneFnOutput: # TODO: write your logic here raise Exception("fnOne not implemented") @typed_fnTwo -def fnTwo(inp: TwoInput, ctx: Ctx) -> TypeScalarString1: +def fnTwo(inp: TwoInput, ctx: Ctx) -> TypeString5fd9b: # TODO: write your logic here raise Exception("fnTwo not implemented") @@ -564,23 +564,22 @@ macro_rules! init_mat { // gen-static-end use types::*; pub mod types { - pub type ScalarString1 = String; #[derive(Debug, serde::Serialize, serde::Deserialize)] - pub struct ScalarStructShared1 { - pub name: ScalarString1, + pub struct Struct62ec9 { + pub name: String, } - pub type ScalarInteger1 = i64; + pub type StudentIdInteger = i64; pub type StudentPeersPlaceholderOptional = Option; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct Student { - pub id: ScalarInteger1, - pub name: ScalarString1, + pub id: StudentIdInteger, + pub name: String, pub peers: StudentPeersPlaceholderOptional, } pub type RootOneFnOutput = Vec; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct TwoInput { - pub name: ScalarString1, + pub name: String, } } pub mod stubs { @@ -603,7 +602,7 @@ pub mod stubs { } } - fn handle(&self, input: ScalarStructShared1, cx: Ctx) -> anyhow::Result; + fn handle(&self, input: Struct62ec9, cx: Ctx) -> anyhow::Result; } pub trait RootTwoFn: Sized + 'static { fn erased(self) -> ErasedHandler { @@ -623,7 +622,7 @@ pub mod stubs { } } - fn handle(&self, input: TwoInput, cx: Ctx) -> anyhow::Result; + fn handle(&self, input: TwoInput, cx: Ctx) -> anyhow::Result; } pub trait RootThreeFn: Sized + 'static { fn erased(self) -> ErasedHandler { @@ -643,7 +642,7 @@ pub mod stubs { } } - fn handle(&self, input: ScalarStructShared1, cx: Ctx) -> anyhow::Result; + fn handle(&self, input: Struct62ec9, cx: Ctx) -> anyhow::Result; } pub fn op_to_trait_name(op_name: &str) -> &'static str { match op_name { @@ -719,26 +718,25 @@ export type Handler = ( tg: Deployment, ) => Out | Promise; -export type ScalarString1 = string; -export type ScalarStructShared1 = { - name: ScalarString1; +export type Struct62ec9 = { + name: string; }; -export type ScalarInteger1 = number; +export type StudentIdInteger = number; export type StudentPeersPlaceholderOptional = RootOneFnOutput | null | undefined; export type Student = { - id: ScalarInteger1; - name: ScalarString1; + id: StudentIdInteger; + name: string; peers?: StudentPeersPlaceholderOptional; }; export type RootOneFnOutput = Array; export type TwoInput = { - name: ScalarString1; + name: string; }; -export type RootOneFnHandler = Handler; -export type RootTwoFnHandler = Handler; -export type RootThreeFnHandler = Handler; +export type RootOneFnHandler = Handler; +export type RootTwoFnHandler = Handler; +export type RootThreeFnHandler = Handler; ', overwrite: true, path: "./workspace/some/base/path/ts/fdk.ts", @@ -892,11 +890,11 @@ class Struct: @dataclass -class ScalarStructShared1(Struct): +class Struct62ec9(Struct): name: str -FORWARD_REFS["ScalarStructShared1"] = ScalarStructShared1 +FORWARD_REFS["Struct62ec9"] = Struct62ec9 @dataclass @@ -917,9 +915,9 @@ def __repr(value: Any): -def typed_three(user_fn: Callable[[ScalarStructShared1, Ctx], Student]): +def typed_three(user_fn: Callable[[Struct62ec9, Ctx], Student]): def exported_wrapper(raw_inp, ctx): - inp: ScalarStructShared1 = Struct.new(ScalarStructShared1, raw_inp) + inp: Struct62ec9 = Struct.new(Struct62ec9, raw_inp) out: Student = user_fn(inp, ctx) if isinstance(out, list): return [__repr(v) for v in out] @@ -937,11 +935,11 @@ def typed_three(user_fn: Callable[[ScalarStructShared1, Ctx], Student]): # are supported. I.e. prefixed by \`.\` or \`..\` # - Make sure to include any module imports in the \`deps\` # array when using external modules with PythonRuntime -from .other_types import ScalarStructShared1, Student, typed_three +from .other_types import Struct62ec9, Student, typed_three @typed_three -def three(inp: ScalarStructShared1, ctx: Ctx) -> Student: +def three(inp: Struct62ec9, ctx: Ctx) -> Student: # TODO: write your logic here raise Exception("three not implemented") @@ -1038,11 +1036,11 @@ class Struct: @dataclass -class ScalarStructShared1(Struct): +class Struct62ec9(Struct): name: str -FORWARD_REFS["ScalarStructShared1"] = ScalarStructShared1 +FORWARD_REFS["Struct62ec9"] = Struct62ec9 @dataclass @@ -1064,7 +1062,7 @@ FORWARD_REFS["TwoInput"] = TwoInput TypeRootOneFnOutput = List["Student"] -TypeScalarString1 = str +TypeString5fd9b = str def __repr(value: Any): if isinstance(value, Struct): @@ -1073,9 +1071,9 @@ def __repr(value: Any): -def typed_fnOne(user_fn: Callable[[ScalarStructShared1, Ctx], TypeRootOneFnOutput]): +def typed_fnOne(user_fn: Callable[[Struct62ec9, Ctx], TypeRootOneFnOutput]): def exported_wrapper(raw_inp, ctx): - inp: ScalarStructShared1 = Struct.new(ScalarStructShared1, raw_inp) + inp: Struct62ec9 = Struct.new(Struct62ec9, raw_inp) out: TypeRootOneFnOutput = user_fn(inp, ctx) if isinstance(out, list): return [__repr(v) for v in out] @@ -1084,10 +1082,10 @@ def typed_fnOne(user_fn: Callable[[ScalarStructShared1, Ctx], TypeRootOneFnOutpu return exported_wrapper -def typed_fnTwo(user_fn: Callable[[TwoInput, Ctx], TypeScalarString1]): +def typed_fnTwo(user_fn: Callable[[TwoInput, Ctx], TypeString5fd9b]): def exported_wrapper(raw_inp, ctx): inp: TwoInput = Struct.new(TwoInput, raw_inp) - out: TypeScalarString1 = user_fn(inp, ctx) + out: TypeString5fd9b = user_fn(inp, ctx) if isinstance(out, list): return [__repr(v) for v in out] return __repr(out) @@ -1104,16 +1102,16 @@ def typed_fnTwo(user_fn: Callable[[TwoInput, Ctx], TypeScalarString1]): # are supported. I.e. prefixed by \`.\` or \`..\` # - Make sure to include any module imports in the \`deps\` # array when using external modules with PythonRuntime -from .same_hit_types import ScalarStructShared1, TwoInput, TypeRootOneFnOutput, TypeScalarString1, typed_fnOne, typed_fnTwo +from .same_hit_types import Struct62ec9, TwoInput, TypeRootOneFnOutput, TypeString5fd9b, typed_fnOne, typed_fnTwo @typed_fnOne -def fnOne(inp: ScalarStructShared1, ctx: Ctx) -> TypeRootOneFnOutput: +def fnOne(inp: Struct62ec9, ctx: Ctx) -> TypeRootOneFnOutput: # TODO: write your logic here raise Exception("fnOne not implemented") @typed_fnTwo -def fnTwo(inp: TwoInput, ctx: Ctx) -> TypeScalarString1: +def fnTwo(inp: TwoInput, ctx: Ctx) -> TypeString5fd9b: # TODO: write your logic here raise Exception("fnTwo not implemented") @@ -1365,23 +1363,22 @@ macro_rules! init_mat { // gen-static-end use types::*; pub mod types { - pub type ScalarString1 = String; #[derive(Debug, serde::Serialize, serde::Deserialize)] - pub struct ScalarStructShared1 { - pub name: ScalarString1, + pub struct Struct62ec9 { + pub name: String, } - pub type ScalarInteger1 = i64; + pub type StudentIdInteger = i64; pub type StudentPeersPlaceholderOptional = Option; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct Student { - pub id: ScalarInteger1, - pub name: ScalarString1, + pub id: StudentIdInteger, + pub name: String, pub peers: StudentPeersPlaceholderOptional, } pub type RootOneFnOutput = Vec; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct TwoInput { - pub name: ScalarString1, + pub name: String, } } pub mod stubs { @@ -1404,7 +1401,7 @@ pub mod stubs { } } - fn handle(&self, input: ScalarStructShared1, cx: Ctx) -> anyhow::Result; + fn handle(&self, input: Struct62ec9, cx: Ctx) -> anyhow::Result; } pub trait RootTwoFn: Sized + 'static { fn erased(self) -> ErasedHandler { @@ -1424,7 +1421,7 @@ pub mod stubs { } } - fn handle(&self, input: TwoInput, cx: Ctx) -> anyhow::Result; + fn handle(&self, input: TwoInput, cx: Ctx) -> anyhow::Result; } pub trait RootThreeFn: Sized + 'static { fn erased(self) -> ErasedHandler { @@ -1444,7 +1441,7 @@ pub mod stubs { } } - fn handle(&self, input: ScalarStructShared1, cx: Ctx) -> anyhow::Result; + fn handle(&self, input: Struct62ec9, cx: Ctx) -> anyhow::Result; } pub fn op_to_trait_name(op_name: &str) -> &'static str { match op_name { @@ -1520,26 +1517,25 @@ export type Handler = ( tg: Deployment, ) => Out | Promise; -export type ScalarString1 = string; -export type ScalarStructShared1 = { - name: ScalarString1; +export type Struct62ec9 = { + name: string; }; -export type ScalarInteger1 = number; +export type StudentIdInteger = number; export type StudentPeersPlaceholderOptional = RootOneFnOutput | null | undefined; export type Student = { - id: ScalarInteger1; - name: ScalarString1; + id: StudentIdInteger; + name: string; peers?: StudentPeersPlaceholderOptional; }; export type RootOneFnOutput = Array; export type TwoInput = { - name: ScalarString1; + name: string; }; -export type RootOneFnHandler = Handler; -export type RootTwoFnHandler = Handler; -export type RootThreeFnHandler = Handler; +export type RootOneFnHandler = Handler; +export type RootTwoFnHandler = Handler; +export type RootThreeFnHandler = Handler; ', overwrite: true, path: "./workspace/some/base/path/ts/fdk.ts", @@ -1693,11 +1689,11 @@ class Struct: @dataclass -class MyNamespaceScalarStructShared1(Struct): +class MyNamespaceStruct62ec9(Struct): name: str -FORWARD_REFS["ScalarStructShared1"] = ScalarStructShared1 +FORWARD_REFS["Struct62ec9"] = Struct62ec9 @dataclass @@ -1718,9 +1714,9 @@ def __repr(value: Any): -def typed_three(user_fn: Callable[[ScalarStructShared1, Ctx], Student]): +def typed_three(user_fn: Callable[[Struct62ec9, Ctx], Student]): def exported_wrapper(raw_inp, ctx): - inp: ScalarStructShared1 = Struct.new(ScalarStructShared1, raw_inp) + inp: Struct62ec9 = Struct.new(Struct62ec9, raw_inp) out: Student = user_fn(inp, ctx) if isinstance(out, list): return [__repr(v) for v in out] @@ -1738,11 +1734,11 @@ def typed_three(user_fn: Callable[[ScalarStructShared1, Ctx], Student]): # are supported. I.e. prefixed by \`.\` or \`..\` # - Make sure to include any module imports in the \`deps\` # array when using external modules with PythonRuntime -from .other_types import ScalarStructShared1, Student, typed_three +from .other_types import Struct62ec9, Student, typed_three @typed_three -def three(inp: ScalarStructShared1, ctx: Ctx) -> Student: +def three(inp: Struct62ec9, ctx: Ctx) -> Student: # TODO: write your logic here raise Exception("three not implemented") @@ -1839,11 +1835,11 @@ class Struct: @dataclass -class MyNamespaceScalarStructShared1(Struct): +class MyNamespaceStruct62ec9(Struct): name: str -FORWARD_REFS["ScalarStructShared1"] = ScalarStructShared1 +FORWARD_REFS["Struct62ec9"] = Struct62ec9 @dataclass @@ -1865,7 +1861,7 @@ FORWARD_REFS["TwoInput"] = TwoInput TypeRootOneFnOutput = List["Student"] -TypeScalarString1 = str +TypeString5fd9b = str def __repr(value: Any): if isinstance(value, Struct): @@ -1874,9 +1870,9 @@ def __repr(value: Any): -def typed_fnOne(user_fn: Callable[[ScalarStructShared1, Ctx], TypeRootOneFnOutput]): +def typed_fnOne(user_fn: Callable[[Struct62ec9, Ctx], TypeRootOneFnOutput]): def exported_wrapper(raw_inp, ctx): - inp: ScalarStructShared1 = Struct.new(ScalarStructShared1, raw_inp) + inp: Struct62ec9 = Struct.new(Struct62ec9, raw_inp) out: TypeRootOneFnOutput = user_fn(inp, ctx) if isinstance(out, list): return [__repr(v) for v in out] @@ -1885,10 +1881,10 @@ def typed_fnOne(user_fn: Callable[[ScalarStructShared1, Ctx], TypeRootOneFnOutpu return exported_wrapper -def typed_fnTwo(user_fn: Callable[[TwoInput, Ctx], TypeScalarString1]): +def typed_fnTwo(user_fn: Callable[[TwoInput, Ctx], TypeString5fd9b]): def exported_wrapper(raw_inp, ctx): inp: TwoInput = Struct.new(TwoInput, raw_inp) - out: TypeScalarString1 = user_fn(inp, ctx) + out: TypeString5fd9b = user_fn(inp, ctx) if isinstance(out, list): return [__repr(v) for v in out] return __repr(out) @@ -1905,16 +1901,16 @@ def typed_fnTwo(user_fn: Callable[[TwoInput, Ctx], TypeScalarString1]): # are supported. I.e. prefixed by \`.\` or \`..\` # - Make sure to include any module imports in the \`deps\` # array when using external modules with PythonRuntime -from .same_hit_types import ScalarStructShared1, TwoInput, TypeRootOneFnOutput, TypeScalarString1, typed_fnOne, typed_fnTwo +from .same_hit_types import Struct62ec9, TwoInput, TypeRootOneFnOutput, TypeString5fd9b, typed_fnOne, typed_fnTwo @typed_fnOne -def fnOne(inp: ScalarStructShared1, ctx: Ctx) -> TypeRootOneFnOutput: +def fnOne(inp: Struct62ec9, ctx: Ctx) -> TypeRootOneFnOutput: # TODO: write your logic here raise Exception("fnOne not implemented") @typed_fnTwo -def fnTwo(inp: TwoInput, ctx: Ctx) -> TypeScalarString1: +def fnTwo(inp: TwoInput, ctx: Ctx) -> TypeString5fd9b: # TODO: write your logic here raise Exception("fnTwo not implemented") @@ -2016,11 +2012,11 @@ class Struct: @dataclass -class MyNamespaceScalarStructShared1(Struct): +class MyNamespaceStruct62ec9(Struct): name: str -FORWARD_REFS["ScalarStructShared1"] = ScalarStructShared1 +FORWARD_REFS["Struct62ec9"] = Struct62ec9 @dataclass @@ -2041,9 +2037,9 @@ def __repr(value: Any): -def typed_three(user_fn: Callable[[ScalarStructShared1, Ctx], Student]): +def typed_three(user_fn: Callable[[Struct62ec9, Ctx], Student]): def exported_wrapper(raw_inp, ctx): - inp: ScalarStructShared1 = Struct.new(ScalarStructShared1, raw_inp) + inp: Struct62ec9 = Struct.new(Struct62ec9, raw_inp) out: Student = user_fn(inp, ctx) if isinstance(out, list): return [__repr(v) for v in out] @@ -2061,11 +2057,11 @@ def typed_three(user_fn: Callable[[ScalarStructShared1, Ctx], Student]): # are supported. I.e. prefixed by \`.\` or \`..\` # - Make sure to include any module imports in the \`deps\` # array when using external modules with PythonRuntime -from .other_types import ScalarStructShared1, Student, typed_three +from .other_types import Struct62ec9, Student, typed_three @typed_three -def three(inp: ScalarStructShared1, ctx: Ctx) -> Student: +def three(inp: Struct62ec9, ctx: Ctx) -> Student: # TODO: write your logic here raise Exception("three not implemented") @@ -2162,11 +2158,11 @@ class Struct: @dataclass -class MyNamespaceScalarStructShared1(Struct): +class MyNamespaceStruct62ec9(Struct): name: str -FORWARD_REFS["ScalarStructShared1"] = ScalarStructShared1 +FORWARD_REFS["Struct62ec9"] = Struct62ec9 @dataclass @@ -2188,7 +2184,7 @@ FORWARD_REFS["TwoInput"] = TwoInput TypeRootOneFnOutput = List["Student"] -TypeScalarString1 = str +TypeString5fd9b = str def __repr(value: Any): if isinstance(value, Struct): @@ -2197,9 +2193,9 @@ def __repr(value: Any): -def typed_fnOne(user_fn: Callable[[ScalarStructShared1, Ctx], TypeRootOneFnOutput]): +def typed_fnOne(user_fn: Callable[[Struct62ec9, Ctx], TypeRootOneFnOutput]): def exported_wrapper(raw_inp, ctx): - inp: ScalarStructShared1 = Struct.new(ScalarStructShared1, raw_inp) + inp: Struct62ec9 = Struct.new(Struct62ec9, raw_inp) out: TypeRootOneFnOutput = user_fn(inp, ctx) if isinstance(out, list): return [__repr(v) for v in out] @@ -2208,10 +2204,10 @@ def typed_fnOne(user_fn: Callable[[ScalarStructShared1, Ctx], TypeRootOneFnOutpu return exported_wrapper -def typed_fnTwo(user_fn: Callable[[TwoInput, Ctx], TypeScalarString1]): +def typed_fnTwo(user_fn: Callable[[TwoInput, Ctx], TypeString5fd9b]): def exported_wrapper(raw_inp, ctx): inp: TwoInput = Struct.new(TwoInput, raw_inp) - out: TypeScalarString1 = user_fn(inp, ctx) + out: TypeString5fd9b = user_fn(inp, ctx) if isinstance(out, list): return [__repr(v) for v in out] return __repr(out) @@ -2228,16 +2224,16 @@ def typed_fnTwo(user_fn: Callable[[TwoInput, Ctx], TypeScalarString1]): # are supported. I.e. prefixed by \`.\` or \`..\` # - Make sure to include any module imports in the \`deps\` # array when using external modules with PythonRuntime -from .same_hit_types import ScalarStructShared1, TwoInput, TypeRootOneFnOutput, TypeScalarString1, typed_fnOne, typed_fnTwo +from .same_hit_types import Struct62ec9, TwoInput, TypeRootOneFnOutput, TypeString5fd9b, typed_fnOne, typed_fnTwo @typed_fnOne -def fnOne(inp: ScalarStructShared1, ctx: Ctx) -> TypeRootOneFnOutput: +def fnOne(inp: Struct62ec9, ctx: Ctx) -> TypeRootOneFnOutput: # TODO: write your logic here raise Exception("fnOne not implemented") @typed_fnTwo -def fnTwo(inp: TwoInput, ctx: Ctx) -> TypeScalarString1: +def fnTwo(inp: TwoInput, ctx: Ctx) -> TypeString5fd9b: # TODO: write your logic here raise Exception("fnTwo not implemented") diff --git a/tests/metagen/typegraphs/identities/rs/fdk.rs b/tests/metagen/typegraphs/identities/rs/fdk.rs index 00db94ab4..e5cc2e6a7 100644 --- a/tests/metagen/typegraphs/identities/rs/fdk.rs +++ b/tests/metagen/typegraphs/identities/rs/fdk.rs @@ -219,42 +219,42 @@ macro_rules! init_mat { // gen-static-end use types::*; pub mod types { - pub type ScalarString1 = String; - pub type ScalarStringEnum1 = String; - pub type ScalarStringUuid1 = String; - pub type ScalarStringEmail1 = String; - pub type ScalarStringEan1 = String; - pub type ScalarStringJson1 = String; - pub type ScalarStringUri1 = String; - pub type ScalarStringDate1 = String; - pub type ScalarStringDatetime1 = String; - pub type ScalarInteger1 = i64; - pub type ScalarFloat1 = f64; - pub type ScalarBoolean1 = bool; + pub type PrimitivesStrString = String; + pub type PrimitivesEnumStringEnum = String; + pub type PrimitivesUuidStringUuid = String; + pub type PrimitivesEmailStringEmail = String; + pub type PrimitivesEanStringEan = String; + pub type PrimitivesJsonStringJson = String; + pub type PrimitivesUriStringUri = String; + pub type PrimitivesDateStringDate = String; + pub type PrimitivesDatetimeStringDatetime = String; + pub type PrimitivesIntInteger = i64; + pub type PrimitivesFloatFloat = f64; + pub type PrimitivesBooleanBoolean = bool; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct Primitives { - pub str: ScalarString1, + pub str: PrimitivesStrString, #[serde(rename = "enum")] - pub r#enum: ScalarStringEnum1, - pub uuid: ScalarStringUuid1, - pub email: ScalarStringEmail1, - pub ean: ScalarStringEan1, - pub json: ScalarStringJson1, - pub uri: ScalarStringUri1, - pub date: ScalarStringDate1, - pub datetime: ScalarStringDatetime1, - pub int: ScalarInteger1, - pub float: ScalarFloat1, - pub boolean: ScalarBoolean1, + pub r#enum: PrimitivesEnumStringEnum, + pub uuid: PrimitivesUuidStringUuid, + pub email: PrimitivesEmailStringEmail, + pub ean: PrimitivesEanStringEan, + pub json: PrimitivesJsonStringJson, + pub uri: PrimitivesUriStringUri, + pub date: PrimitivesDateStringDate, + pub datetime: PrimitivesDatetimeStringDatetime, + pub int: PrimitivesIntInteger, + pub float: PrimitivesFloatFloat, + pub boolean: PrimitivesBooleanBoolean, } #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct PrimitivesArgs { pub data: Primitives, } - pub type CompositesOptScalarString1Optional = Option; + pub type CompositesOptPrimitivesStrStringOptional = Option; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct Branch2 { - pub branch2: ScalarString1, + pub branch2: PrimitivesStrString, } #[derive(Debug, serde::Serialize, serde::Deserialize)] #[serde(untagged)] @@ -262,24 +262,24 @@ pub mod types { Primitives(Primitives), Branch2(Branch2), } - pub type ScalarStringEnum2 = String; - pub type Branch4 = Vec; + pub type CompositesUnionUnionT0StringEnum = String; + pub type Branch4 = Vec; pub type Branch4again = String; #[derive(Debug, serde::Serialize, serde::Deserialize)] #[serde(untagged)] pub enum CompositesUnionUnion { Branch4(Branch4), - ScalarInteger1(ScalarInteger1), - ScalarString1(ScalarString1), + PrimitivesIntInteger(PrimitivesIntInteger), + PrimitivesStrString(PrimitivesStrString), Branch4again(Branch4again), } - pub type CompositesListScalarString1List = Vec; + pub type CompositesListPrimitivesStrStringList = Vec; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct Composites { - pub opt: CompositesOptScalarString1Optional, + pub opt: CompositesOptPrimitivesStrStringOptional, pub either: CompositesEitherEither, pub union: CompositesUnionUnion, - pub list: CompositesListScalarString1List, + pub list: CompositesListPrimitivesStrStringList, } #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct CompositesArgs { @@ -288,12 +288,12 @@ pub mod types { pub type Branch33ATo1Cycles1Optional = Option; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct Branch33A { - pub phantom3a: CompositesOptScalarString1Optional, + pub phantom3a: CompositesOptPrimitivesStrStringOptional, pub to1: Branch33ATo1Cycles1Optional, } #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct Branch33B { - pub phantom3b: CompositesOptScalarString1Optional, + pub phantom3b: CompositesOptPrimitivesStrStringOptional, pub to2: Cycles1To2Cycles2Optional, } #[derive(Debug, serde::Serialize, serde::Deserialize)] @@ -313,7 +313,7 @@ pub mod types { pub type Cycles1List3Cycles1List3Cycles3ListOptional = Option; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct Cycles1 { - pub phantom1: CompositesOptScalarString1Optional, + pub phantom1: CompositesOptPrimitivesStrStringOptional, pub to2: Box, pub list3: Cycles1List3Cycles1List3Cycles3ListOptional, } @@ -324,19 +324,19 @@ pub mod types { pub type SimpleCycles3To1SimpleCycles1Optional = Option; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct SimpleCycles3 { - pub phantom3: CompositesOptScalarString1Optional, + pub phantom3: CompositesOptPrimitivesStrStringOptional, pub to1: SimpleCycles3To1SimpleCycles1Optional, } pub type SimpleCycles2To3SimpleCycles3Optional = Option; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct SimpleCycles2 { - pub phantom2: CompositesOptScalarString1Optional, + pub phantom2: CompositesOptPrimitivesStrStringOptional, pub to3: SimpleCycles2To3SimpleCycles3Optional, } pub type SimpleCycles1To2SimpleCycles2Optional = Option; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct SimpleCycles1 { - pub phantom1: CompositesOptScalarString1Optional, + pub phantom1: CompositesOptPrimitivesStrStringOptional, pub to2: Box, } #[derive(Debug, serde::Serialize, serde::Deserialize)] diff --git a/tests/metagen/typegraphs/identities/ts/fdk.ts b/tests/metagen/typegraphs/identities/ts/fdk.ts index 61e714220..80702013e 100644 --- a/tests/metagen/typegraphs/identities/ts/fdk.ts +++ b/tests/metagen/typegraphs/identities/ts/fdk.ts @@ -33,67 +33,67 @@ export type Handler = ( tg: Deployment, ) => Out | Promise; -export type ScalarString1 = string; -export type ScalarStringEnum1 = "wan" | "tew" | "tree"; -export type ScalarStringUuid1 = string; -export type ScalarStringEmail1 = string; -export type ScalarStringEan1 = string; -export type ScalarStringJson1 = string; -export type ScalarStringUri1 = string; -export type ScalarStringDate1 = string; -export type ScalarStringDatetime1 = string; -export type ScalarInteger1 = number; -export type ScalarFloat1 = number; -export type ScalarBoolean1 = boolean; +export type PrimitivesStrString = string; +export type PrimitivesEnumStringEnum = "wan" | "tew" | "tree"; +export type PrimitivesUuidStringUuid = string; +export type PrimitivesEmailStringEmail = string; +export type PrimitivesEanStringEan = string; +export type PrimitivesJsonStringJson = string; +export type PrimitivesUriStringUri = string; +export type PrimitivesDateStringDate = string; +export type PrimitivesDatetimeStringDatetime = string; +export type PrimitivesIntInteger = number; +export type PrimitivesFloatFloat = number; +export type PrimitivesBooleanBoolean = boolean; export type Primitives = { - str: ScalarString1; - "enum": ScalarStringEnum1; - uuid: ScalarStringUuid1; - email: ScalarStringEmail1; - ean: ScalarStringEan1; - json: ScalarStringJson1; - uri: ScalarStringUri1; - date: ScalarStringDate1; - datetime: ScalarStringDatetime1; - int: ScalarInteger1; - float: ScalarFloat1; - "boolean": ScalarBoolean1; + str: PrimitivesStrString; + "enum": PrimitivesEnumStringEnum; + uuid: PrimitivesUuidStringUuid; + email: PrimitivesEmailStringEmail; + ean: PrimitivesEanStringEan; + json: PrimitivesJsonStringJson; + uri: PrimitivesUriStringUri; + date: PrimitivesDateStringDate; + datetime: PrimitivesDatetimeStringDatetime; + int: PrimitivesIntInteger; + float: PrimitivesFloatFloat; + "boolean": PrimitivesBooleanBoolean; }; export type PrimitivesArgs = { data: Primitives; }; -export type CompositesOptScalarString1Optional = ScalarString1 | null | undefined; +export type CompositesOptPrimitivesStrStringOptional = PrimitivesStrString | null | undefined; export type Branch2 = { - branch2: ScalarString1; + branch2: PrimitivesStrString; }; export type CompositesEitherEither = | (Primitives) | (Branch2); -export type ScalarStringEnum2 = "grey" | "beige"; -export type Branch4 = Array; +export type CompositesUnionUnionT0StringEnum = "grey" | "beige"; +export type Branch4 = Array; export type Branch4again = string; export type CompositesUnionUnion = | (Branch4) - | (ScalarInteger1) - | (ScalarString1) + | (PrimitivesIntInteger) + | (PrimitivesStrString) | (Branch4again); -export type CompositesListScalarString1List = Array; +export type CompositesListPrimitivesStrStringList = Array; export type Composites = { - opt?: CompositesOptScalarString1Optional; + opt?: CompositesOptPrimitivesStrStringOptional; either: CompositesEitherEither; union: CompositesUnionUnion; - list: CompositesListScalarString1List; + list: CompositesListPrimitivesStrStringList; }; export type CompositesArgs = { data: Composites; }; export type Branch33ATo1Cycles1Optional = Cycles1 | null | undefined; export type Branch33A = { - phantom3a?: CompositesOptScalarString1Optional; + phantom3a?: CompositesOptPrimitivesStrStringOptional; to1?: Branch33ATo1Cycles1Optional; }; export type Branch33B = { - phantom3b?: CompositesOptScalarString1Optional; + phantom3b?: CompositesOptPrimitivesStrStringOptional; to2?: Cycles1To2Cycles2Optional; }; export type Cycles3 = @@ -106,7 +106,7 @@ export type Cycles1To2Cycles2Optional = Cycles2 | null | undefined; export type Cycles1List3Cycles3List = Array; export type Cycles1List3Cycles1List3Cycles3ListOptional = Cycles1List3Cycles3List | null | undefined; export type Cycles1 = { - phantom1?: CompositesOptScalarString1Optional; + phantom1?: CompositesOptPrimitivesStrStringOptional; to2?: Cycles1To2Cycles2Optional; list3?: Cycles1List3Cycles1List3Cycles3ListOptional; }; @@ -115,17 +115,17 @@ export type Cycles1Args = { }; export type SimpleCycles3To1SimpleCycles1Optional = SimpleCycles1 | null | undefined; export type SimpleCycles3 = { - phantom3?: CompositesOptScalarString1Optional; + phantom3?: CompositesOptPrimitivesStrStringOptional; to1?: SimpleCycles3To1SimpleCycles1Optional; }; export type SimpleCycles2To3SimpleCycles3Optional = SimpleCycles3 | null | undefined; export type SimpleCycles2 = { - phantom2?: CompositesOptScalarString1Optional; + phantom2?: CompositesOptPrimitivesStrStringOptional; to3?: SimpleCycles2To3SimpleCycles3Optional; }; export type SimpleCycles1To2SimpleCycles2Optional = SimpleCycles2 | null | undefined; export type SimpleCycles1 = { - phantom1?: CompositesOptScalarString1Optional; + phantom1?: CompositesOptPrimitivesStrStringOptional; to2?: SimpleCycles1To2SimpleCycles2Optional; }; export type SimpleCycles1Args = { diff --git a/tests/metagen/typegraphs/sample/py/client.py b/tests/metagen/typegraphs/sample/py/client.py index 85e64bc2e..f3cd8d388 100644 --- a/tests/metagen/typegraphs/sample/py/client.py +++ b/tests/metagen/typegraphs/sample/py/client.py @@ -872,9 +872,9 @@ def RootScalarArgsFn(): sub_nodes=return_node.sub_nodes, variants=return_node.variants, arg_types={ - "id": "ScalarStringUuid1", - "slug": "ScalarString1", - "title": "ScalarString1", + "id": "UserIdStringUuid", + "slug": "StringE1a43", + "title": "StringE1a43", }, ) @@ -893,7 +893,7 @@ def RootCompositeArgsFn(): sub_nodes=return_node.sub_nodes, variants=return_node.variants, arg_types={ - "id": "ScalarString1", + "id": "StringE1a43", }, ) @@ -904,7 +904,7 @@ def RootScalarUnionFn(): sub_nodes=return_node.sub_nodes, variants=return_node.variants, arg_types={ - "id": "ScalarString1", + "id": "StringE1a43", }, ) @@ -924,7 +924,7 @@ def RootCompositeUnionFn(): sub_nodes=return_node.sub_nodes, variants=return_node.variants, arg_types={ - "id": "ScalarString1", + "id": "StringE1a43", }, ) @@ -944,7 +944,7 @@ def RootMixedUnionFn(): sub_nodes=return_node.sub_nodes, variants=return_node.variants, arg_types={ - "id": "ScalarString1", + "id": "StringE1a43", }, ) @@ -992,47 +992,43 @@ def RootNestedCompositeFn(): ) -ScalarStringUuid1 = str - -ScalarString1 = str +UserIdStringUuid = str Post = typing.TypedDict( "Post", { - "id": ScalarStringUuid1, - "slug": ScalarString1, - "title": ScalarString1, + "id": UserIdStringUuid, + "slug": str, + "title": str, }, total=False, ) -ScalarStructShared2 = typing.TypedDict( - "ScalarStructShared2", +StructC339c = typing.TypedDict( + "StructC339c", { - "id": ScalarString1, + "id": str, }, total=False, ) -ScalarStringEmail1 = str +UserEmailStringEmail = str UserPostsPostList = typing.List[Post] User = typing.TypedDict( "User", { - "id": ScalarStringUuid1, - "email": ScalarStringEmail1, + "id": UserIdStringUuid, + "email": UserEmailStringEmail, "posts": UserPostsPostList, }, total=False, ) -ScalarInteger1 = int - RootScalarUnionFnOutput = typing.Union[ - ScalarString1, - ScalarInteger1, + str, + int, ] @@ -1045,15 +1041,15 @@ def RootNestedCompositeFn(): RootMixedUnionFnOutput = typing.Union[ Post, User, - ScalarString1, - ScalarInteger1, + str, + int, ] RootNestedCompositeFnOutputCompositeStructNestedStruct = typing.TypedDict( "RootNestedCompositeFnOutputCompositeStructNestedStruct", { - "inner": ScalarInteger1, + "inner": int, }, total=False, ) @@ -1061,7 +1057,7 @@ def RootNestedCompositeFn(): RootNestedCompositeFnOutputCompositeStruct = typing.TypedDict( "RootNestedCompositeFnOutputCompositeStruct", { - "value": ScalarInteger1, + "value": int, "nested": RootNestedCompositeFnOutputCompositeStructNestedStruct, }, total=False, @@ -1070,7 +1066,7 @@ def RootNestedCompositeFn(): RootNestedCompositeFnOutputListStruct = typing.TypedDict( "RootNestedCompositeFnOutputListStruct", { - "value": ScalarInteger1, + "value": int, }, total=False, ) @@ -1082,7 +1078,7 @@ def RootNestedCompositeFn(): RootNestedCompositeFnOutput = typing.TypedDict( "RootNestedCompositeFnOutput", { - "scalar": ScalarInteger1, + "scalar": int, "composite": RootNestedCompositeFnOutputCompositeStruct, "list": RootNestedCompositeFnOutputListRootNestedCompositeFnOutputListStructList, }, @@ -1182,8 +1178,8 @@ class QueryGraph(QueryGraphBase): def __init__(self): super().__init__( { - "ScalarStringUuid1": "String!", - "ScalarString1": "String!", + "UserIdStringUuid": "String!", + "StringE1a43": "String!", "post": "post!", "user": "user!", } @@ -1205,7 +1201,7 @@ def get_posts(self, select: PostSelections) -> QueryNode[Post]: node.node_name, node.instance_name, node.args, node.sub_nodes, node.files ) - def scalar_no_args(self) -> QueryNode[ScalarString1]: + def scalar_no_args(self) -> QueryNode[str]: node = selection_to_nodes( {"scalarNoArgs": True}, {"scalarNoArgs": NodeDescs.RootScalarNoArgsFn}, "$q" )[0] @@ -1215,7 +1211,7 @@ def scalar_no_args(self) -> QueryNode[ScalarString1]: def scalar_args( self, args: typing.Union[Post, PlaceholderArgs] - ) -> MutationNode[ScalarString1]: + ) -> MutationNode[str]: node = selection_to_nodes( {"scalarArgs": args}, {"scalarArgs": NodeDescs.RootScalarArgsFn}, "$q" )[0] @@ -1234,9 +1230,7 @@ def composite_no_args(self, select: PostSelections) -> MutationNode[Post]: ) def composite_args( - self, - args: typing.Union[ScalarStructShared2, PlaceholderArgs], - select: PostSelections, + self, args: typing.Union[StructC339c, PlaceholderArgs], select: PostSelections ) -> MutationNode[Post]: node = selection_to_nodes( {"compositeArgs": (args, select)}, @@ -1248,7 +1242,7 @@ def composite_args( ) def scalar_union( - self, args: typing.Union[ScalarStructShared2, PlaceholderArgs] + self, args: typing.Union[StructC339c, PlaceholderArgs] ) -> QueryNode[RootScalarUnionFnOutput]: node = selection_to_nodes( {"scalarUnion": args}, {"scalarUnion": NodeDescs.RootScalarUnionFn}, "$q" @@ -1259,7 +1253,7 @@ def scalar_union( def composite_union( self, - args: typing.Union[ScalarStructShared2, PlaceholderArgs], + args: typing.Union[StructC339c, PlaceholderArgs], select: RootCompositeUnionFnOutputSelections, ) -> QueryNode[RootCompositeUnionFnOutput]: node = selection_to_nodes( @@ -1273,7 +1267,7 @@ def composite_union( def mixed_union( self, - args: typing.Union[ScalarStructShared2, PlaceholderArgs], + args: typing.Union[StructC339c, PlaceholderArgs], select: RootMixedUnionFnOutputSelections, ) -> QueryNode[RootMixedUnionFnOutput]: node = selection_to_nodes( diff --git a/tests/metagen/typegraphs/sample/py_upload/client.py b/tests/metagen/typegraphs/sample/py_upload/client.py index 1437c33ec..e7561d279 100644 --- a/tests/metagen/typegraphs/sample/py_upload/client.py +++ b/tests/metagen/typegraphs/sample/py_upload/client.py @@ -828,8 +828,8 @@ def RootUploadFn(): sub_nodes=return_node.sub_nodes, variants=return_node.variants, arg_types={ - "file": "ScalarFileShared1", - "path": "RootUploadFnInputPathScalarString1Optional", + "file": "FileBf9b7", + "path": "RootUploadFnInputPathString25e51Optional", }, input_files=[[".file"]], ) @@ -841,58 +841,54 @@ def RootUploadManyFn(): sub_nodes=return_node.sub_nodes, variants=return_node.variants, arg_types={ - "prefix": "RootUploadManyFnInputPrefixScalarString1Optional", - "files": "RootUploadManyFnInputFilesScalarFileShared1List", + "prefix": "RootUploadManyFnInputPrefixString25e51Optional", + "files": "RootUploadManyFnInputFilesFileBf9b7List", }, input_files=[[".files", "[]"]], ) -ScalarFileShared1 = File +FileBf9b7 = File -ScalarString1 = str - -RootUploadFnInputPathScalarString1Optional = typing.Union[ScalarString1, None] +RootUploadFnInputPathString25e51Optional = typing.Union[str, None] RootUploadFnInput = typing.TypedDict( "RootUploadFnInput", { - "file": ScalarFileShared1, - "path": RootUploadFnInputPathScalarString1Optional, + "file": FileBf9b7, + "path": RootUploadFnInputPathString25e51Optional, }, total=False, ) -RootUploadManyFnInputPrefixScalarString1Optional = typing.Union[ScalarString1, None] +RootUploadManyFnInputPrefixString25e51Optional = typing.Union[str, None] -RootUploadManyFnInputFilesScalarFileShared1List = typing.List[ScalarFileShared1] +RootUploadManyFnInputFilesFileBf9b7List = typing.List[FileBf9b7] RootUploadManyFnInput = typing.TypedDict( "RootUploadManyFnInput", { - "prefix": RootUploadManyFnInputPrefixScalarString1Optional, - "files": RootUploadManyFnInputFilesScalarFileShared1List, + "prefix": RootUploadManyFnInputPrefixString25e51Optional, + "files": RootUploadManyFnInputFilesFileBf9b7List, }, total=False, ) -ScalarBoolean1 = bool - class QueryGraph(QueryGraphBase): def __init__(self): super().__init__( { - "ScalarFileShared1": "scalar_file_shared_1!", - "RootUploadFnInputPathScalarString1Optional": "String", - "RootUploadManyFnInputPrefixScalarString1Optional": "String", - "RootUploadManyFnInputFilesScalarFileShared1List": "[scalar_file_shared_1]!", + "FileBf9b7": "file_bf9b7!", + "RootUploadFnInputPathString25e51Optional": "String", + "RootUploadManyFnInputPrefixString25e51Optional": "String", + "RootUploadManyFnInputFilesFileBf9b7List": "[file_bf9b7]!", } ) def upload( self, args: typing.Union[RootUploadFnInput, PlaceholderArgs] - ) -> MutationNode[ScalarBoolean1]: + ) -> MutationNode[bool]: node = selection_to_nodes( {"upload": args}, {"upload": NodeDescs.RootUploadFn}, "$q" )[0] @@ -902,7 +898,7 @@ def upload( def upload_many( self, args: typing.Union[RootUploadManyFnInput, PlaceholderArgs] - ) -> MutationNode[ScalarBoolean1]: + ) -> MutationNode[bool]: node = selection_to_nodes( {"uploadMany": args}, {"uploadMany": NodeDescs.RootUploadManyFn}, "$q" )[0] diff --git a/tests/metagen/typegraphs/sample/rs/client.rs b/tests/metagen/typegraphs/sample/rs/client.rs index e45fc4298..c7a9f3208 100644 --- a/tests/metagen/typegraphs/sample/rs/client.rs +++ b/tests/metagen/typegraphs/sample/rs/client.rs @@ -85,9 +85,9 @@ mod node_metas { NodeMeta { arg_types: Some( [ - ("id".into(), "ScalarStringUuid1".into()), - ("slug".into(), "ScalarString1".into()), - ("title".into(), "ScalarString1".into()), + ("id".into(), "UserIdStringUuid".into()), + ("slug".into(), "StringE1a43".into()), + ("title".into(), "StringE1a43".into()), ].into() ), ..scalar() @@ -102,7 +102,7 @@ mod node_metas { NodeMeta { arg_types: Some( [ - ("id".into(), "ScalarString1".into()), + ("id".into(), "StringE1a43".into()), ].into() ), ..Post() @@ -112,7 +112,7 @@ mod node_metas { NodeMeta { arg_types: Some( [ - ("id".into(), "ScalarString1".into()), + ("id".into(), "StringE1a43".into()), ].into() ), ..scalar() @@ -135,7 +135,7 @@ mod node_metas { NodeMeta { arg_types: Some( [ - ("id".into(), "ScalarString1".into()), + ("id".into(), "StringE1a43".into()), ].into() ), ..RootCompositeUnionFnOutput() @@ -158,7 +158,7 @@ mod node_metas { NodeMeta { arg_types: Some( [ - ("id".into(), "ScalarString1".into()), + ("id".into(), "StringE1a43".into()), ].into() ), ..RootMixedUnionFnOutput() @@ -224,32 +224,30 @@ mod node_metas { } use types::*; pub mod types { - pub type ScalarStringUuid1 = String; - pub type ScalarString1 = String; + pub type UserIdStringUuid = String; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct PostPartial { - pub id: Option, - pub slug: Option, - pub title: Option, + pub id: Option, + pub slug: Option, + pub title: Option, } #[derive(Debug, serde::Serialize, serde::Deserialize)] - pub struct ScalarStructShared2Partial { - pub id: Option, + pub struct StructC339cPartial { + pub id: Option, } - pub type ScalarStringEmail1 = String; + pub type UserEmailStringEmail = String; pub type UserPostsPostList = Vec; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct UserPartial { - pub id: Option, - pub email: Option, + pub id: Option, + pub email: Option, pub posts: Option, } - pub type ScalarInteger1 = i64; #[derive(Debug, serde::Serialize, serde::Deserialize)] #[serde(untagged)] pub enum RootScalarUnionFnOutput { - ScalarString1(ScalarString1), - ScalarInteger1(ScalarInteger1), + String(String), + I64(i64), } #[derive(Debug, serde::Serialize, serde::Deserialize)] #[serde(untagged)] @@ -262,26 +260,26 @@ pub mod types { pub enum RootMixedUnionFnOutput { PostPartial(PostPartial), UserPartial(UserPartial), - ScalarString1(ScalarString1), - ScalarInteger1(ScalarInteger1), + String(String), + I64(i64), } #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct RootNestedCompositeFnOutputCompositeStructNestedStructPartial { - pub inner: Option, + pub inner: Option, } #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct RootNestedCompositeFnOutputCompositeStructPartial { - pub value: Option, + pub value: Option, pub nested: Option, } #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct RootNestedCompositeFnOutputListStructPartial { - pub value: Option, + pub value: Option, } pub type RootNestedCompositeFnOutputListRootNestedCompositeFnOutputListStructList = Vec; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct RootNestedCompositeFnOutputPartial { - pub scalar: Option, + pub scalar: Option, pub composite: Option, pub list: Option, } @@ -343,8 +341,8 @@ impl QueryGraph { addr, ty_to_gql_ty_map: std::sync::Arc::new([ - ("ScalarStringUuid1".into(), "String!".into()), - ("ScalarString1".into(), "String!".into()), + ("UserIdStringUuid".into(), "String!".into()), + ("StringE1a43".into(), "String!".into()), ("post".into(), "post!".into()), ("user".into(), "user!".into()), ].into()), @@ -375,7 +373,7 @@ impl QueryGraph { } pub fn scalar_no_args( &self, - ) -> QueryNode + ) -> QueryNode { let nodes = selection_to_node_set( SelectionErasedMap( @@ -396,7 +394,7 @@ impl QueryGraph { pub fn scalar_args( &self, args: impl Into> - ) -> MutationNode + ) -> MutationNode { let nodes = selection_to_node_set( SelectionErasedMap( @@ -427,7 +425,7 @@ impl QueryGraph { } pub fn composite_args( &self, - args: impl Into> + args: impl Into> ) -> UnselectedNode, MutationMarker, PostPartial> { UnselectedNode { @@ -439,7 +437,7 @@ impl QueryGraph { } pub fn scalar_union( &self, - args: impl Into> + args: impl Into> ) -> QueryNode { let nodes = selection_to_node_set( @@ -460,7 +458,7 @@ impl QueryGraph { } pub fn composite_union( &self, - args: impl Into> + args: impl Into> ) -> UnselectedNode, QueryMarker, RootCompositeUnionFnOutput> { UnselectedNode { @@ -472,7 +470,7 @@ impl QueryGraph { } pub fn mixed_union( &self, - args: impl Into> + args: impl Into> ) -> UnselectedNode, QueryMarker, RootMixedUnionFnOutput> { UnselectedNode { diff --git a/tests/metagen/typegraphs/sample/rs/main.rs b/tests/metagen/typegraphs/sample/rs/main.rs index d8ba8afc5..f12683e2c 100644 --- a/tests/metagen/typegraphs/sample/rs/main.rs +++ b/tests/metagen/typegraphs/sample/rs/main.rs @@ -37,8 +37,8 @@ fn main() -> Result<(), BoxErr> { ( api1.scalar_args(args.get("post", |val: types::PostPartial| val)), api1.composite_no_args().select(all()), - api1.composite_args(args.get("id", |id: String| { - types::ScalarStructShared2Partial { id: Some(id) } + api1.composite_args(args.get("id", |id: String| types::StructC339cPartial { + id: Some(id), })) .select(all()), ) @@ -98,7 +98,7 @@ fn main() -> Result<(), BoxErr> { title: Some("".into()), }), api1.composite_no_args().select(all()), - api1.composite_args(types::ScalarStructShared2Partial { + api1.composite_args(types::StructC339cPartial { id: Some("94be5420-8c4a-4e67-b4f4-e1b2b54832a2".into()), }) .select(all()), @@ -107,11 +107,11 @@ fn main() -> Result<(), BoxErr> { let res5 = gql .query(( - api1.scalar_union(types::ScalarStructShared2Partial { + api1.scalar_union(types::StructC339cPartial { id: Some("94be5420-8c4a-4e67-b4f4-e1b2b54832a2".into()), }), // allows ignoring some members - api1.composite_union(types::ScalarStructShared2Partial { + api1.composite_union(types::StructC339cPartial { id: Some("94be5420-8c4a-4e67-b4f4-e1b2b54832a2".into()), }) .select(RootCompositeUnionFnOutputSelections { @@ -120,14 +120,14 @@ fn main() -> Result<(), BoxErr> { }), // returns empty if returned type wasn't selected // in union member - api1.composite_union(types::ScalarStructShared2Partial { + api1.composite_union(types::StructC339cPartial { id: Some("94be5420-8c4a-4e67-b4f4-e1b2b54832a2".into()), }) .select(RootCompositeUnionFnOutputSelections { user: select(all()), ..default() }), - api1.mixed_union(types::ScalarStructShared2Partial { + api1.mixed_union(types::StructC339cPartial { id: Some("94be5420-8c4a-4e67-b4f4-e1b2b54832a2".into()), }) .select(RootMixedUnionFnOutputSelections { diff --git a/tests/metagen/typegraphs/sample/rs_upload/client.rs b/tests/metagen/typegraphs/sample/rs_upload/client.rs index c2d8a4fa7..38b00263e 100644 --- a/tests/metagen/typegraphs/sample/rs_upload/client.rs +++ b/tests/metagen/typegraphs/sample/rs_upload/client.rs @@ -42,10 +42,10 @@ mod node_metas { NodeMeta { arg_types: Some( [ - ("file".into(), "ScalarFileShared1".into()), + ("file".into(), "FileBf9b7".into()), ( "path".into(), - "RootUploadFnInputPathScalarString1Optional".into(), + "RootUploadFnInputPathString25e51Optional".into(), ), ] .into(), @@ -62,11 +62,11 @@ mod node_metas { [ ( "prefix".into(), - "RootUploadManyFnInputPrefixScalarString1Optional".into(), + "RootUploadManyFnInputPrefixString25e51Optional".into(), ), ( "files".into(), - "RootUploadManyFnInputFilesScalarFileShared1List".into(), + "RootUploadManyFnInputFilesFileBf9b7List".into(), ), ] .into(), @@ -81,22 +81,20 @@ mod node_metas { } use types::*; pub mod types { - pub type ScalarFileShared1 = super::FileId; - pub type ScalarString1 = String; - pub type RootUploadFnInputPathScalarString1Optional = Option; + pub type FileBf9b7 = super::FileId; + pub type RootUploadFnInputPathString25e51Optional = Option; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct RootUploadFnInputPartial { - pub file: Option, - pub path: RootUploadFnInputPathScalarString1Optional, + pub file: Option, + pub path: RootUploadFnInputPathString25e51Optional, } - pub type RootUploadManyFnInputPrefixScalarString1Optional = Option; - pub type RootUploadManyFnInputFilesScalarFileShared1List = Vec; + pub type RootUploadManyFnInputPrefixString25e51Optional = Option; + pub type RootUploadManyFnInputFilesFileBf9b7List = Vec; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct RootUploadManyFnInputPartial { - pub prefix: RootUploadManyFnInputPrefixScalarString1Optional, - pub files: Option, + pub prefix: RootUploadManyFnInputPrefixString25e51Optional, + pub files: Option, } - pub type ScalarBoolean1 = bool; } impl QueryGraph { @@ -105,18 +103,18 @@ impl QueryGraph { addr, ty_to_gql_ty_map: std::sync::Arc::new( [ - ("ScalarFileShared1".into(), "scalar_file_shared_1!".into()), + ("FileBf9b7".into(), "file_bf9b7!".into()), ( - "RootUploadFnInputPathScalarString1Optional".into(), + "RootUploadFnInputPathString25e51Optional".into(), "String".into(), ), ( - "RootUploadManyFnInputPrefixScalarString1Optional".into(), + "RootUploadManyFnInputPrefixString25e51Optional".into(), "String".into(), ), ( - "RootUploadManyFnInputFilesScalarFileShared1List".into(), - "[scalar_file_shared_1]!".into(), + "RootUploadManyFnInputFilesFileBf9b7List".into(), + "[file_bf9b7]!".into(), ), ] .into(), @@ -127,7 +125,7 @@ impl QueryGraph { pub fn upload( &self, args: impl Into>, - ) -> MutationNode { + ) -> MutationNode { let nodes = selection_to_node_set( SelectionErasedMap( [( @@ -145,7 +143,7 @@ impl QueryGraph { pub fn upload_many( &self, args: impl Into>, - ) -> MutationNode { + ) -> MutationNode { let nodes = selection_to_node_set( SelectionErasedMap( [( diff --git a/tests/metagen/typegraphs/sample/ts/client.ts b/tests/metagen/typegraphs/sample/ts/client.ts index 0f7e2940a..fb0fe7aa6 100644 --- a/tests/metagen/typegraphs/sample/ts/client.ts +++ b/tests/metagen/typegraphs/sample/ts/client.ts @@ -915,9 +915,9 @@ const nodeMetas = { return { ...nodeMetas.scalar(), argumentTypes: { - id: "ScalarStringUuid1", - slug: "ScalarString1", - title: "ScalarString1", + id: "UserIdStringUuid", + slug: "StringE1a43", + title: "StringE1a43", }, }; }, @@ -930,7 +930,7 @@ const nodeMetas = { return { ...nodeMetas.Post(), argumentTypes: { - id: "ScalarString1", + id: "StringE1a43", }, }; }, @@ -938,7 +938,7 @@ const nodeMetas = { return { ...nodeMetas.scalar(), argumentTypes: { - id: "ScalarString1", + id: "StringE1a43", }, }; }, @@ -954,7 +954,7 @@ const nodeMetas = { return { ...nodeMetas.RootCompositeUnionFnOutput(), argumentTypes: { - id: "ScalarString1", + id: "StringE1a43", }, }; }, @@ -970,7 +970,7 @@ const nodeMetas = { return { ...nodeMetas.RootMixedUnionFnOutput(), argumentTypes: { - id: "ScalarString1", + id: "StringE1a43", }, }; }, @@ -1011,48 +1011,46 @@ const nodeMetas = { }; }, }; -export type ScalarStringUuid1 = string; -export type ScalarString1 = string; +export type UserIdStringUuid = string; export type Post = { - id: ScalarStringUuid1; - slug: ScalarString1; - title: ScalarString1; + id: UserIdStringUuid; + slug: string; + title: string; }; -export type ScalarStructShared2 = { - id: ScalarString1; +export type StructC339c = { + id: string; }; -export type ScalarStringEmail1 = string; +export type UserEmailStringEmail = string; export type UserPostsPostList = Array; export type User = { - id: ScalarStringUuid1; - email: ScalarStringEmail1; + id: UserIdStringUuid; + email: UserEmailStringEmail; posts: UserPostsPostList; }; -export type ScalarInteger1 = number; export type RootScalarUnionFnOutput = - | (ScalarString1) - | (ScalarInteger1); + | (string) + | (number); export type RootCompositeUnionFnOutput = | (Post) | (User); export type RootMixedUnionFnOutput = | (Post) | (User) - | (ScalarString1) - | (ScalarInteger1); + | (string) + | (number); export type RootNestedCompositeFnOutputCompositeStructNestedStruct = { - inner: ScalarInteger1; + inner: number; }; export type RootNestedCompositeFnOutputCompositeStruct = { - value: ScalarInteger1; + value: number; nested: RootNestedCompositeFnOutputCompositeStructNestedStruct; }; export type RootNestedCompositeFnOutputListStruct = { - value: ScalarInteger1; + value: number; }; export type RootNestedCompositeFnOutputListRootNestedCompositeFnOutputListStructList = Array; export type RootNestedCompositeFnOutput = { - scalar: ScalarInteger1; + scalar: number; composite: RootNestedCompositeFnOutputCompositeStruct; list: RootNestedCompositeFnOutputListRootNestedCompositeFnOutputListStructList; }; @@ -1102,8 +1100,8 @@ export type RootNestedCompositeFnOutputSelections = { export class QueryGraph extends _QueryGraphBase { constructor() { super({ - "ScalarStringUuid1": "String!", - "ScalarString1": "String!", + "UserIdStringUuid": "String!", + "StringE1a43": "String!", "post": "post!", "user": "user!", }); @@ -1131,7 +1129,7 @@ export class QueryGraph extends _QueryGraphBase { [["scalarNoArgs", nodeMetas.RootScalarNoArgsFn]], "$q", )[0]; - return new QueryNode(inner) as QueryNode; + return new QueryNode(inner) as QueryNode; } scalarArgs(args: Post | PlaceholderArgs) { const inner = _selectionToNodeSet( @@ -1139,7 +1137,7 @@ export class QueryGraph extends _QueryGraphBase { [["scalarArgs", nodeMetas.RootScalarArgsFn]], "$q", )[0]; - return new MutationNode(inner) as MutationNode; + return new MutationNode(inner) as MutationNode; } compositeNoArgs(select: PostSelections) { const inner = _selectionToNodeSet( @@ -1149,7 +1147,7 @@ export class QueryGraph extends _QueryGraphBase { )[0]; return new MutationNode(inner) as MutationNode; } - compositeArgs(args: ScalarStructShared2 | PlaceholderArgs, select: PostSelections) { + compositeArgs(args: StructC339c | PlaceholderArgs, select: PostSelections) { const inner = _selectionToNodeSet( { "compositeArgs": [args, select] }, [["compositeArgs", nodeMetas.RootCompositeArgsFn]], @@ -1157,7 +1155,7 @@ export class QueryGraph extends _QueryGraphBase { )[0]; return new MutationNode(inner) as MutationNode; } - scalarUnion(args: ScalarStructShared2 | PlaceholderArgs) { + scalarUnion(args: StructC339c | PlaceholderArgs) { const inner = _selectionToNodeSet( { "scalarUnion": args }, [["scalarUnion", nodeMetas.RootScalarUnionFn]], @@ -1165,7 +1163,7 @@ export class QueryGraph extends _QueryGraphBase { )[0]; return new QueryNode(inner) as QueryNode; } - compositeUnion(args: ScalarStructShared2 | PlaceholderArgs, select: RootCompositeUnionFnOutputSelections) { + compositeUnion(args: StructC339c | PlaceholderArgs, select: RootCompositeUnionFnOutputSelections) { const inner = _selectionToNodeSet( { "compositeUnion": [args, select] }, [["compositeUnion", nodeMetas.RootCompositeUnionFn]], @@ -1173,7 +1171,7 @@ export class QueryGraph extends _QueryGraphBase { )[0]; return new QueryNode(inner) as QueryNode; } - mixedUnion(args: ScalarStructShared2 | PlaceholderArgs, select: RootMixedUnionFnOutputSelections) { + mixedUnion(args: StructC339c | PlaceholderArgs, select: RootMixedUnionFnOutputSelections) { const inner = _selectionToNodeSet( { "mixedUnion": [args, select] }, [["mixedUnion", nodeMetas.RootMixedUnionFn]], diff --git a/tests/metagen/typegraphs/sample/ts_upload/client.ts b/tests/metagen/typegraphs/sample/ts_upload/client.ts index 331729e2d..faa9a07de 100644 --- a/tests/metagen/typegraphs/sample/ts_upload/client.ts +++ b/tests/metagen/typegraphs/sample/ts_upload/client.ts @@ -882,8 +882,8 @@ const nodeMetas = { return { ...nodeMetas.scalar(), argumentTypes: { - file: "ScalarFileShared1", - path: "RootUploadFnInputPathScalarString1Optional", + file: "FileBf9b7", + path: "RootUploadFnInputPathString25e51Optional", }, inputFiles: [[".file"]], }; @@ -892,36 +892,34 @@ const nodeMetas = { return { ...nodeMetas.scalar(), argumentTypes: { - prefix: "RootUploadManyFnInputPrefixScalarString1Optional", - files: "RootUploadManyFnInputFilesScalarFileShared1List", + prefix: "RootUploadManyFnInputPrefixString25e51Optional", + files: "RootUploadManyFnInputFilesFileBf9b7List", }, inputFiles: [[".files","[]"]], }; }, }; -export type ScalarFileShared1 = File; -export type ScalarString1 = string; -export type RootUploadFnInputPathScalarString1Optional = ScalarString1 | null | undefined; +export type FileBf9b7 = File; +export type RootUploadFnInputPathString25e51Optional = string | null | undefined; export type RootUploadFnInput = { - file: ScalarFileShared1; - path?: RootUploadFnInputPathScalarString1Optional; + file: FileBf9b7; + path?: RootUploadFnInputPathString25e51Optional; }; -export type RootUploadManyFnInputPrefixScalarString1Optional = ScalarString1 | null | undefined; -export type RootUploadManyFnInputFilesScalarFileShared1List = Array; +export type RootUploadManyFnInputPrefixString25e51Optional = string | null | undefined; +export type RootUploadManyFnInputFilesFileBf9b7List = Array; export type RootUploadManyFnInput = { - prefix?: RootUploadManyFnInputPrefixScalarString1Optional; - files: RootUploadManyFnInputFilesScalarFileShared1List; + prefix?: RootUploadManyFnInputPrefixString25e51Optional; + files: RootUploadManyFnInputFilesFileBf9b7List; }; -export type ScalarBoolean1 = boolean; export class QueryGraph extends _QueryGraphBase { constructor() { super({ - "ScalarFileShared1": "scalar_file_shared_1!", - "RootUploadFnInputPathScalarString1Optional": "String", - "RootUploadManyFnInputPrefixScalarString1Optional": "String", - "RootUploadManyFnInputFilesScalarFileShared1List": "[scalar_file_shared_1]!", + "FileBf9b7": "file_bf9b7!", + "RootUploadFnInputPathString25e51Optional": "String", + "RootUploadManyFnInputPrefixString25e51Optional": "String", + "RootUploadManyFnInputFilesFileBf9b7List": "[file_bf9b7]!", }); } @@ -931,7 +929,7 @@ export class QueryGraph extends _QueryGraphBase { [["upload", nodeMetas.RootUploadFn]], "$q", )[0]; - return new MutationNode(inner) as MutationNode; + return new MutationNode(inner) as MutationNode; } uploadMany(args: RootUploadManyFnInput | PlaceholderArgs) { const inner = _selectionToNodeSet( @@ -939,6 +937,6 @@ export class QueryGraph extends _QueryGraphBase { [["uploadMany", nodeMetas.RootUploadManyFn]], "$q", )[0]; - return new MutationNode(inner) as MutationNode; + return new MutationNode(inner) as MutationNode; } } diff --git a/tests/planner/__snapshots__/planner_test.ts.snap b/tests/planner/__snapshots__/planner_test.ts.snap index 3a67182e5..b726cd48e 100644 --- a/tests/planner/__snapshots__/planner_test.ts.snap +++ b/tests/planner/__snapshots__/planner_test.ts.snap @@ -35,7 +35,7 @@ snapshot[`planner 1`] = ` ], type: { format: "email", - title: "root_one_fn_output_email_string_email", + title: "string_email_1b9c2", type: "string", }, }, @@ -60,7 +60,7 @@ snapshot[`planner 1`] = ` "first", ], type: { - title: "root_one_fn_output_nested_struct_first_string", + title: "string_cbe33", type: "string", }, }, @@ -170,110 +170,110 @@ snapshot[`planner 2`] = ` snapshot[`planner 3`] = ` [ "one one one object root_one_fn_output false", - "one.union1 union1 one/union1 union root_one_fn_output_union1_union false", - "one.union2 union2 one/union2 union root_one_fn_output_union2_union false", - "one.union2\$A.a a one/union2\$A/a integer root_one_fn_output_union1_union_t0_integer false", + "one.union1 union1 one/union1 union union_aa854 false", + "one.union2 union2 one/union2 union union_2f7ce false", + "one.union2\$A.a a one/union2\$A/a integer integer_6d74d false", "one.union2\$B.b b one/union2\$B/b either B_b_either false", - "one.union2\$B.b\$C1.c c one/union2\$B/b\$C1/c integer root_one_fn_output_union1_union_t0_integer false", - "one.union2\$B.b\$C2.c c one/union2\$B/b\$C2/c string root_one_fn_output_nested_struct_first_string false", + "one.union2\$B.b\$C1.c c one/union2\$B/b\$C1/c integer integer_6d74d false", + "one.union2\$B.b\$C2.c c one/union2\$B/b\$C2/c string string_cbe33 false", ] `; snapshot[`planner 4`] = ` [ "one one one object root_one_fn_output false", - "one.union2 union2 one/union2 union root_one_fn_output_union2_union true", - "one.union2\$A.a a one/union2\$A/a integer root_one_fn_output_union1_union_t0_integer false", + "one.union2 union2 one/union2 union union_2f7ce true", + "one.union2\$A.a a one/union2\$A/a integer integer_6d74d false", "one.union2\$B.b b one/union2\$B/b either B_b_either false", - "one.union2\$B.b\$C1.c c one/union2\$B/b\$C1/c integer root_one_fn_output_union1_union_t0_integer false", - "one.union2\$B.b\$C2.c c one/union2\$B/b\$C2/c string root_one_fn_output_nested_struct_first_string false", - "one.from_union2 from_union2 one/from_union2 integer root_one_fn_output_union1_union_t0_integer false", - "one.union1 union1 one/union1 union root_one_fn_output_union1_union true", - "one.from_union1 from_union1 one/from_union1 integer root_one_fn_output_union1_union_t0_integer false", + "one.union2\$B.b\$C1.c c one/union2\$B/b\$C1/c integer integer_6d74d false", + "one.union2\$B.b\$C2.c c one/union2\$B/b\$C2/c string string_cbe33 false", + "one.from_union2 from_union2 one/from_union2 integer integer_6d74d false", + "one.union1 union1 one/union1 union union_aa854 true", + "one.from_union1 from_union1 one/from_union1 integer integer_6d74d false", ] `; snapshot[`planner: dependencies 1`] = ` [ "two two two object root_two_fn_output false", - "two.id id two/id integer root_one_fn_output_union1_union_t0_integer false", - "two.email email two/email string root_one_fn_output_email_string_email false", + "two.id id two/id integer integer_6d74d false", + "two.email email two/email string string_email_1b9c2 false", ] `; snapshot[`planner: dependencies 2`] = ` [ "two two two object root_two_fn_output false", - "two.id id two/id integer root_one_fn_output_union1_union_t0_integer false", - "two.email email two/email string root_one_fn_output_email_string_email false", - "two.profile profile two/profile object root_two_fn_output_profile_fn_output false", - "two.profile.firstName firstName two/profile/firstName string root_one_fn_output_nested_struct_first_string false", - "two.profile.lastName lastName two/profile/lastName string root_one_fn_output_nested_struct_first_string false", - "two.profile.profilePic profilePic two/profile/profilePic string root_one_fn_output_nested_struct_first_string false", + "two.id id two/id integer integer_6d74d false", + "two.email email two/email string string_email_1b9c2 false", + "two.profile profile two/profile object struct_c9440 false", + "two.profile.firstName firstName two/profile/firstName string string_cbe33 false", + "two.profile.lastName lastName two/profile/lastName string string_cbe33 false", + "two.profile.profilePic profilePic two/profile/profilePic string string_cbe33 false", ] `; snapshot[`planner: dependencies 3`] = ` [ "two two two object root_two_fn_output false", - "two.id id two/id integer root_one_fn_output_union1_union_t0_integer false", - "two.email email two/email string root_one_fn_output_email_string_email false", - "two.profile profile two/profile object root_two_fn_output_profile_fn_output false", - "two.profile.firstName firstName two/profile/firstName string root_one_fn_output_nested_struct_first_string false", - "two.profile.lastName lastName two/profile/lastName string root_one_fn_output_nested_struct_first_string false", - "two.profile.profilePic profilePic two/profile/profilePic string root_one_fn_output_nested_struct_first_string false", + "two.id id two/id integer integer_6d74d false", + "two.email email two/email string string_email_1b9c2 false", + "two.profile profile two/profile object struct_c9440 false", + "two.profile.firstName firstName two/profile/firstName string string_cbe33 false", + "two.profile.lastName lastName two/profile/lastName string string_cbe33 false", + "two.profile.profilePic profilePic two/profile/profilePic string string_cbe33 false", ] `; snapshot[`planner: dependencies 4`] = ` [ "two two two object root_two_fn_output false", - "two.email email two/email string root_one_fn_output_email_string_email true", - "two.profile profile two/profile object root_two_fn_output_profile_fn_output false", - "two.profile.firstName firstName two/profile/firstName string root_one_fn_output_nested_struct_first_string false", - "two.profile.lastName lastName two/profile/lastName string root_one_fn_output_nested_struct_first_string false", - "two.profile.profilePic profilePic two/profile/profilePic string root_one_fn_output_nested_struct_first_string false", - "two.id id two/id integer root_one_fn_output_union1_union_t0_integer false", + "two.email email two/email string string_email_1b9c2 true", + "two.profile profile two/profile object struct_c9440 false", + "two.profile.firstName firstName two/profile/firstName string string_cbe33 false", + "two.profile.lastName lastName two/profile/lastName string string_cbe33 false", + "two.profile.profilePic profilePic two/profile/profilePic string string_cbe33 false", + "two.id id two/id integer integer_6d74d false", ] `; snapshot[`planner: dependencies 5`] = ` [ "two two two object root_two_fn_output false", - "two.email email two/email string root_one_fn_output_email_string_email true", - "two.profile profile two/profile object root_two_fn_output_profile_fn_output false", - "two.profile.firstName firstName two/profile/firstName string root_one_fn_output_nested_struct_first_string false", - "two.profile.lastName lastName two/profile/lastName string root_one_fn_output_nested_struct_first_string false", - "two.profile.profilePic profilePic two/profile/profilePic string root_one_fn_output_nested_struct_first_string false", - "two.taggedPic taggedPic two/taggedPic string root_one_fn_output_nested_struct_first_string false", + "two.email email two/email string string_email_1b9c2 true", + "two.profile profile two/profile object struct_c9440 false", + "two.profile.firstName firstName two/profile/firstName string string_cbe33 false", + "two.profile.lastName lastName two/profile/lastName string string_cbe33 false", + "two.profile.profilePic profilePic two/profile/profilePic string string_cbe33 false", + "two.taggedPic taggedPic two/taggedPic string string_cbe33 false", ] `; snapshot[`planner: dependencies 6`] = ` [ "two two two object root_two_fn_output false", - "two.id id two/id integer root_one_fn_output_union1_union_t0_integer false", - "two.email email two/email string root_one_fn_output_email_string_email true", - "two.profile profile two/profile object root_two_fn_output_profile_fn_output true", - "two.profile.email email two/profile/email string root_one_fn_output_email_string_email false", - "two.profile.firstName firstName two/profile/firstName string root_one_fn_output_nested_struct_first_string false", - "two.profile.lastName lastName two/profile/lastName string root_one_fn_output_nested_struct_first_string false", - "two.profile.profilePic profilePic two/profile/profilePic string root_one_fn_output_nested_struct_first_string false", - "two.taggedPic taggedPic two/taggedPic string root_one_fn_output_nested_struct_first_string false", + "two.id id two/id integer integer_6d74d false", + "two.email email two/email string string_email_1b9c2 true", + "two.profile profile two/profile object struct_c9440 true", + "two.profile.email email two/profile/email string string_email_1b9c2 false", + "two.profile.firstName firstName two/profile/firstName string string_cbe33 false", + "two.profile.lastName lastName two/profile/lastName string string_cbe33 false", + "two.profile.profilePic profilePic two/profile/profilePic string string_cbe33 false", + "two.taggedPic taggedPic two/taggedPic string string_cbe33 false", ] `; snapshot[`planner: dependencies in union/either 1`] = ` [ "three three three object root_three_fn_output false", - "three.id id three/id integer root_one_fn_output_union1_union_t0_integer false", + "three.id id three/id integer integer_6d74d false", "three.user user three/user either root_three_fn_output_user_either false", "three.user\$RegisteredUser.id id three/user\$RegisteredUser/id string root_one_fn_output_id_string_uuid false", - "three.user\$RegisteredUser.email email three/user\$RegisteredUser/email string root_one_fn_output_email_string_email false", + "three.user\$RegisteredUser.email email three/user\$RegisteredUser/email string string_email_1b9c2 false", "three.user\$RegisteredUser.profile profile three/user\$RegisteredUser/profile object RegisteredUser_profile_fn_output false", - "three.user\$RegisteredUser.profile.email email three/user\$RegisteredUser/profile/email string root_one_fn_output_email_string_email false", - "three.user\$RegisteredUser.profile.displayName displayName three/user\$RegisteredUser/profile/displayName string root_one_fn_output_nested_struct_first_string false", - "three.user\$RegisteredUser.profile.profilePic profilePic three/user\$RegisteredUser/profile/profilePic string root_one_fn_output_nested_struct_first_string false", + "three.user\$RegisteredUser.profile.email email three/user\$RegisteredUser/profile/email string string_email_1b9c2 false", + "three.user\$RegisteredUser.profile.displayName displayName three/user\$RegisteredUser/profile/displayName string string_cbe33 false", + "three.user\$RegisteredUser.profile.profilePic profilePic three/user\$RegisteredUser/profile/profilePic string string_cbe33 false", "three.user\$GuestUser.id id three/user\$GuestUser/id string root_one_fn_output_id_string_uuid false", ] `; @@ -281,13 +281,13 @@ snapshot[`planner: dependencies in union/either 1`] = ` snapshot[`planner: dependencies in union/either 2`] = ` [ "three three three object root_three_fn_output false", - "three.id id three/id integer root_one_fn_output_union1_union_t0_integer false", + "three.id id three/id integer integer_6d74d false", "three.user user three/user either root_three_fn_output_user_either false", "three.user\$RegisteredUser.id id three/user\$RegisteredUser/id string root_one_fn_output_id_string_uuid false", - "three.user\$RegisteredUser.email email three/user\$RegisteredUser/email string root_one_fn_output_email_string_email true", + "three.user\$RegisteredUser.email email three/user\$RegisteredUser/email string string_email_1b9c2 true", "three.user\$RegisteredUser.profile profile three/user\$RegisteredUser/profile object RegisteredUser_profile_fn_output false", - "three.user\$RegisteredUser.profile.email email three/user\$RegisteredUser/profile/email string root_one_fn_output_email_string_email false", - "three.user\$RegisteredUser.profile.displayName displayName three/user\$RegisteredUser/profile/displayName string root_one_fn_output_nested_struct_first_string false", + "three.user\$RegisteredUser.profile.email email three/user\$RegisteredUser/profile/email string string_email_1b9c2 false", + "three.user\$RegisteredUser.profile.displayName displayName three/user\$RegisteredUser/profile/displayName string string_cbe33 false", "three.user\$GuestUser.id id three/user\$GuestUser/id string root_one_fn_output_id_string_uuid false", ] `; diff --git a/tests/runtimes/graphql/__snapshots__/graphql_test.ts.snap b/tests/runtimes/graphql/__snapshots__/graphql_test.ts.snap index 919086b4f..4517c2ad0 100644 --- a/tests/runtimes/graphql/__snapshots__/graphql_test.ts.snap +++ b/tests/runtimes/graphql/__snapshots__/graphql_test.ts.snap @@ -65,7 +65,7 @@ snapshot[`Typegraph generation with GraphQL runtime 1`] = ` }, { "type": "string", - "title": "scalar_string_1" + "title": "root_user_fn_input_id_string" }, { "type": "object", @@ -187,7 +187,7 @@ snapshot[`Typegraph generation with GraphQL runtime 1`] = ` }, { "type": "integer", - "title": "scalar_integer_1" + "title": "message_create_input_id_integer" }, { "type": "function", @@ -245,7 +245,7 @@ snapshot[`Typegraph generation with GraphQL runtime 1`] = ` }, { "type": "optional", - "title": "message_create_input_id_scalar_integer_1_optional", + "title": "message_create_input_id_message_create_input_id_integer_optional", "item": 14, "default_value": null }, @@ -417,7 +417,7 @@ snapshot[`Typegraph generation with GraphQL runtime 1`] = ` }, { "type": "list", - "title": "_prisma_integer_filter_t4_struct_in_scalar_integer_1_list", + "title": "_prisma_integer_filter_t4_struct_in_message_create_input_id_integer_list", "items": 14 }, { @@ -516,7 +516,7 @@ snapshot[`Typegraph generation with GraphQL runtime 1`] = ` }, { "type": "list", - "title": "_prisma_string_filter_t3_struct_in_scalar_string_1_list", + "title": "_prisma_string_filter_t3_struct_in_root_user_fn_input_id_string_list", "items": 3 }, { @@ -547,13 +547,13 @@ snapshot[`Typegraph generation with GraphQL runtime 1`] = ` }, { "type": "optional", - "title": "_prisma_string_filter_t5_struct_mode_scalar_string_enum_1_optional", + "title": "_prisma_string_filter_t5_struct_mode__prisma_string_filter_t5_struct_mode_string_enum_optional", "item": 47, "default_value": null }, { "type": "string", - "title": "scalar_string_enum_1", + "title": "_prisma_string_filter_t5_struct_mode_string_enum", "enum": [ "\\\\"insensitive\\\\"" ] @@ -586,7 +586,7 @@ snapshot[`Typegraph generation with GraphQL runtime 1`] = ` }, { "type": "optional", - "title": "_prisma_string_filter_t7_struct_startsWith_scalar_string_1_optional", + "title": "_prisma_string_filter_t7_struct_startsWith_root_user_fn_input_id_string_optional", "item": 3, "default_value": null }, @@ -762,7 +762,7 @@ snapshot[`Typegraph generation with GraphQL runtime 1`] = ` }, { "type": "string", - "title": "scalar_string_enum_2", + "title": "message_query_input_distinct_string_enum", "enum": [ "\\\\"id\\\\"", "\\\\"title\\\\"", diff --git a/tests/runtimes/grpc/__snapshots__/grpc_test.ts.snap b/tests/runtimes/grpc/__snapshots__/grpc_test.ts.snap index bb958e1a6..9451e12f2 100644 --- a/tests/runtimes/grpc/__snapshots__/grpc_test.ts.snap +++ b/tests/runtimes/grpc/__snapshots__/grpc_test.ts.snap @@ -44,13 +44,13 @@ snapshot[`Typegraph using grpc 1`] = ` }, { "type": "optional", - "title": "scalar_scalar_string_1_optional_shared_1", + "title": "root_greet_fn_input_name_string_optional_b02c2", "item": 4, "default_value": null }, { "type": "string", - "title": "scalar_string_1" + "title": "root_greet_fn_input_name_string" }, { "type": "object", @@ -180,13 +180,13 @@ snapshot[`Typegraph using grpc 2`] = ` }, { "type": "optional", - "title": "scalar_scalar_string_1_optional_shared_1", + "title": "root_greet_fn_input_name_string_optional_b02c2", "item": 4, "default_value": null }, { "type": "string", - "title": "scalar_string_1" + "title": "root_greet_fn_input_name_string" }, { "type": "object", diff --git a/tests/runtimes/kv/__snapshots__/kv_test.ts.snap b/tests/runtimes/kv/__snapshots__/kv_test.ts.snap index 80856bfa3..4af57a581 100644 --- a/tests/runtimes/kv/__snapshots__/kv_test.ts.snap +++ b/tests/runtimes/kv/__snapshots__/kv_test.ts.snap @@ -52,7 +52,7 @@ snapshot[`Typegraph using kv 1`] = ` }, { "type": "object", - "title": "scalar_struct_shared_1", + "title": "struct_d0873", "properties": { "key": 3 }, @@ -64,11 +64,11 @@ snapshot[`Typegraph using kv 1`] = ` }, { "type": "string", - "title": "scalar_string_1" + "title": "string_a7e0d" }, { "type": "optional", - "title": "scalar_scalar_string_1_optional_shared_1", + "title": "string_a7e0d_optional_d0873", "item": 3, "default_value": null }, @@ -108,7 +108,7 @@ snapshot[`Typegraph using kv 1`] = ` }, { "type": "integer", - "title": "scalar_integer_1" + "title": "root_delete_fn_output" }, { "type": "function", @@ -122,7 +122,7 @@ snapshot[`Typegraph using kv 1`] = ` }, { "type": "object", - "title": "scalar_struct_shared_2", + "title": "struct_443be", "properties": { "filter": 4 }, @@ -134,7 +134,7 @@ snapshot[`Typegraph using kv 1`] = ` }, { "type": "list", - "title": "scalar_scalar_string_1_list_shared_1", + "title": "string_a7e0d_list_443be", "items": 3 }, { @@ -304,7 +304,7 @@ snapshot[`Typegraph using kv 2`] = ` }, { "type": "object", - "title": "scalar_struct_shared_1", + "title": "struct_d0873", "properties": { "key": 3 }, @@ -316,11 +316,11 @@ snapshot[`Typegraph using kv 2`] = ` }, { "type": "string", - "title": "scalar_string_1" + "title": "string_a7e0d" }, { "type": "optional", - "title": "scalar_scalar_string_1_optional_shared_1", + "title": "string_a7e0d_optional_d0873", "item": 3, "default_value": null }, @@ -360,7 +360,7 @@ snapshot[`Typegraph using kv 2`] = ` }, { "type": "integer", - "title": "scalar_integer_1" + "title": "root_delete_fn_output" }, { "type": "function", @@ -374,7 +374,7 @@ snapshot[`Typegraph using kv 2`] = ` }, { "type": "object", - "title": "scalar_struct_shared_2", + "title": "struct_443be", "properties": { "filter": 4 }, @@ -386,7 +386,7 @@ snapshot[`Typegraph using kv 2`] = ` }, { "type": "list", - "title": "scalar_scalar_string_1_list_shared_1", + "title": "string_a7e0d_list_443be", "items": 3 }, { diff --git a/tests/runtimes/s3/__snapshots__/s3_test.ts.snap b/tests/runtimes/s3/__snapshots__/s3_test.ts.snap index c00cd315e..511b87ffe 100644 --- a/tests/runtimes/s3/__snapshots__/s3_test.ts.snap +++ b/tests/runtimes/s3/__snapshots__/s3_test.ts.snap @@ -63,13 +63,13 @@ snapshot[`s3 typegraphs 1`] = ` }, { "type": "optional", - "title": "scalar_scalar_string_1_optional_shared_1", + "title": "string_7c0c4_optional_7c0c4", "item": 4, "default_value": null }, { "type": "string", - "title": "scalar_string_1" + "title": "string_7c0c4" }, { "type": "object", @@ -106,11 +106,11 @@ snapshot[`s3 typegraphs 1`] = ` }, { "type": "integer", - "title": "scalar_integer_1" + "title": "integer_d5974" }, { "type": "list", - "title": "root_listObjects_fn_output_prefix_scalar_string_1_list", + "title": "root_listObjects_fn_output_prefix_string_7c0c4_list", "items": 4 }, { @@ -137,7 +137,7 @@ snapshot[`s3 typegraphs 1`] = ` }, { "type": "string", - "title": "scalar_string_uri_1", + "title": "string_uri_99c36", "format": "uri" }, { @@ -197,7 +197,7 @@ snapshot[`s3 typegraphs 1`] = ` }, { "type": "boolean", - "title": "scalar_boolean_1" + "title": "boolean_02b82" }, { "type": "function", @@ -225,7 +225,7 @@ snapshot[`s3 typegraphs 1`] = ` }, { "type": "optional", - "title": "root_uploadMany_fn_input_prefix_scalar_string_1_optional", + "title": "root_uploadMany_fn_input_prefix_string_7c0c4_optional", "item": 4, "default_value": "" }, diff --git a/tests/runtimes/temporal/__snapshots__/temporal_test.ts.snap b/tests/runtimes/temporal/__snapshots__/temporal_test.ts.snap index c0d6a032f..11d763c39 100644 --- a/tests/runtimes/temporal/__snapshots__/temporal_test.ts.snap +++ b/tests/runtimes/temporal/__snapshots__/temporal_test.ts.snap @@ -63,11 +63,11 @@ snapshot[`Typegraph using temporal 1`] = ` }, { "type": "string", - "title": "scalar_string_1" + "title": "string_e97ab" }, { "type": "list", - "title": "scalar_root_start_fn_input_args_struct_list_shared_1", + "title": "root_start_fn_input_args_struct_list_a2e91", "items": 5 }, { @@ -94,7 +94,7 @@ snapshot[`Typegraph using temporal 1`] = ` }, { "type": "object", - "title": "scalar_struct_shared_1", + "title": "struct_ee884", "properties": { "workflow_id": 3, "run_id": 3, @@ -130,7 +130,7 @@ snapshot[`Typegraph using temporal 1`] = ` }, { "type": "boolean", - "title": "scalar_boolean_1" + "title": "root_signal_fn_output" }, { "type": "function", @@ -174,13 +174,13 @@ snapshot[`Typegraph using temporal 1`] = ` }, { "type": "optional", - "title": "root_describe_fn_output_start_time_scalar_integer_1_optional", + "title": "root_describe_fn_output_start_time_root_describe_fn_output_start_time_integer_optional", "item": 14, "default_value": null }, { "type": "integer", - "title": "scalar_integer_1" + "title": "root_describe_fn_output_start_time_integer" } ], "materializers": [ @@ -349,7 +349,7 @@ snapshot[`Typegraph using temporal 2`] = ` }, { "type": "string", - "title": "scalar_string_1" + "title": "string_03667" }, { "type": "list", @@ -391,7 +391,7 @@ snapshot[`Typegraph using temporal 2`] = ` }, { "type": "list", - "title": "root_query_fn_input_args_scalar_string_1_list", + "title": "root_query_fn_input_args_string_03667_list", "items": 3 }, { @@ -447,7 +447,7 @@ snapshot[`Typegraph using temporal 2`] = ` }, { "type": "boolean", - "title": "scalar_boolean_1" + "title": "root_signal_fn_output" }, { "type": "function", @@ -491,13 +491,13 @@ snapshot[`Typegraph using temporal 2`] = ` }, { "type": "optional", - "title": "root_describe_fn_output_start_time_scalar_integer_1_optional", + "title": "root_describe_fn_output_start_time_root_describe_fn_output_start_time_integer_optional", "item": 19, "default_value": null }, { "type": "integer", - "title": "scalar_integer_1" + "title": "root_describe_fn_output_start_time_integer" } ], "materializers": [ diff --git a/tests/runtimes/typegate/__snapshots__/typegate_prisma_test.ts.snap b/tests/runtimes/typegate/__snapshots__/typegate_prisma_test.ts.snap index 6c4af12eb..3dfa21dad 100644 --- a/tests/runtimes/typegate/__snapshots__/typegate_prisma_test.ts.snap +++ b/tests/runtimes/typegate/__snapshots__/typegate_prisma_test.ts.snap @@ -15,7 +15,7 @@ snapshot[`typegate: find available operations 1`] = ` format: "uuid", optional: false, policies: [], - title: "scalar_string_uuid_1", + title: "record_with_nested_count_id_string_uuid", type: "string", }, }, @@ -28,7 +28,7 @@ snapshot[`typegate: find available operations 1`] = ` format: null, optional: false, policies: [], - title: "scalar_string_1", + title: "_prisma_string_filter_t0_string", type: "string", }, }, @@ -41,7 +41,7 @@ snapshot[`typegate: find available operations 1`] = ` format: null, optional: true, policies: [], - title: "scalar_integer_1", + title: "_prisma_integer_filter_t0_integer", type: "integer", }, }, @@ -54,7 +54,7 @@ snapshot[`typegate: find available operations 1`] = ` format: "date-time", optional: false, policies: [], - title: "scalar_string_datetime_2", + title: "record_cursor_t3_struct_createdAt_string_datetime", type: "string", }, }, @@ -73,7 +73,7 @@ snapshot[`typegate: find available operations 1`] = ` format: "uuid", optional: false, policies: [], - title: "scalar_string_uuid_1", + title: "record_with_nested_count_id_string_uuid", type: "string", }, }, @@ -86,7 +86,7 @@ snapshot[`typegate: find available operations 1`] = ` format: null, optional: false, policies: [], - title: "scalar_string_1", + title: "_prisma_string_filter_t0_string", type: "string", }, }, @@ -99,7 +99,7 @@ snapshot[`typegate: find available operations 1`] = ` format: null, optional: true, policies: [], - title: "scalar_integer_1", + title: "_prisma_integer_filter_t0_integer", type: "integer", }, }, @@ -112,7 +112,7 @@ snapshot[`typegate: find available operations 1`] = ` format: "date-time", optional: false, policies: [], - title: "scalar_string_datetime_2", + title: "record_cursor_t3_struct_createdAt_string_datetime", type: "string", }, }, @@ -131,7 +131,7 @@ snapshot[`typegate: find available operations 1`] = ` format: null, optional: false, policies: [], - title: "scalar_integer_1", + title: "_prisma_integer_filter_t0_integer", type: "integer", }, }, @@ -157,7 +157,7 @@ snapshot[`typegate: find available operations 1`] = ` format: null, optional: false, policies: [], - title: "scalar_string_1", + title: "_prisma_string_filter_t0_string", type: "string", }, }, @@ -170,7 +170,7 @@ snapshot[`typegate: find available operations 1`] = ` format: null, optional: false, policies: [], - title: "scalar_string_1", + title: "_prisma_string_filter_t0_string", type: "string", }, }, @@ -202,7 +202,7 @@ snapshot[`typegate: find available operations 1`] = ` format: "uuid", optional: false, policies: [], - title: "scalar_string_uuid_1", + title: "record_with_nested_count_id_string_uuid", type: "string", }, }, @@ -219,7 +219,7 @@ snapshot[`typegate: find available operations 1`] = ` format: null, optional: false, policies: [], - title: "scalar_string_enum_3", + title: "user_identity_create_input_excluding_rel_user_identity_users_provider_string_enum", type: "string", }, }, @@ -232,7 +232,7 @@ snapshot[`typegate: find available operations 1`] = ` format: null, optional: false, policies: [], - title: "scalar_string_1", + title: "_prisma_string_filter_t0_string", type: "string", }, }, @@ -285,7 +285,7 @@ snapshot[`typegate: find available operations 1`] = ` format: null, optional: false, policies: [], - title: "scalar_integer_1", + title: "_prisma_integer_filter_t0_integer", type: "integer", }, }, @@ -298,7 +298,7 @@ snapshot[`typegate: find available operations 1`] = ` format: null, optional: false, policies: [], - title: "scalar_integer_1", + title: "_prisma_integer_filter_t0_integer", type: "integer", }, }, @@ -311,7 +311,7 @@ snapshot[`typegate: find available operations 1`] = ` format: null, optional: false, policies: [], - title: "scalar_string_1", + title: "_prisma_string_filter_t0_string", type: "string", }, }, diff --git a/tests/runtimes/typegate/__snapshots__/typegate_runtime_test.ts.snap b/tests/runtimes/typegate/__snapshots__/typegate_runtime_test.ts.snap index 69a9313f3..cf9df3a08 100644 --- a/tests/runtimes/typegate/__snapshots__/typegate_runtime_test.ts.snap +++ b/tests/runtimes/typegate/__snapshots__/typegate_runtime_test.ts.snap @@ -32,7 +32,7 @@ snapshot[`typegate: find available operations 1`] = ` enum: null, format: "uuid", optional: false, - title: "scalar_string_uuid_1", + title: "record_with_nested_count_id_string_uuid", type: "string", }, }, @@ -45,7 +45,7 @@ snapshot[`typegate: find available operations 1`] = ` enum: null, format: null, optional: false, - title: "scalar_string_1", + title: "_prisma_string_filter_t0_string", type: "string", }, }, @@ -58,7 +58,7 @@ snapshot[`typegate: find available operations 1`] = ` enum: null, format: null, optional: true, - title: "scalar_integer_1", + title: "_prisma_integer_filter_t0_integer", type: "integer", }, }, @@ -71,7 +71,7 @@ snapshot[`typegate: find available operations 1`] = ` enum: null, format: "date-time", optional: false, - title: "scalar_string_datetime_1", + title: "record_with_nested_count_createdAt_string_datetime", type: "string", }, }, @@ -175,7 +175,7 @@ snapshot[`typegate: find available operations 1`] = ` enum: null, format: "uuid", optional: false, - title: "scalar_string_uuid_1", + title: "record_with_nested_count_id_string_uuid", type: "string", }, }, @@ -188,7 +188,7 @@ snapshot[`typegate: find available operations 1`] = ` enum: null, format: null, optional: false, - title: "scalar_string_1", + title: "_prisma_string_filter_t0_string", type: "string", }, }, @@ -201,7 +201,7 @@ snapshot[`typegate: find available operations 1`] = ` enum: null, format: null, optional: true, - title: "scalar_integer_1", + title: "_prisma_integer_filter_t0_integer", type: "integer", }, }, @@ -214,7 +214,7 @@ snapshot[`typegate: find available operations 1`] = ` enum: null, format: "date-time", optional: false, - title: "scalar_string_datetime_1", + title: "record_with_nested_count_createdAt_string_datetime", type: "string", }, }, @@ -253,7 +253,7 @@ snapshot[`typegate: find available operations 1`] = ` enum: null, format: null, optional: false, - title: "scalar_integer_1", + title: "_prisma_integer_filter_t0_integer", type: "integer", }, }, @@ -279,7 +279,7 @@ snapshot[`typegate: find available operations 1`] = ` enum: null, format: null, optional: false, - title: "scalar_string_1", + title: "_prisma_string_filter_t0_string", type: "string", }, }, @@ -292,7 +292,7 @@ snapshot[`typegate: find available operations 1`] = ` enum: null, format: null, optional: false, - title: "scalar_string_1", + title: "_prisma_string_filter_t0_string", type: "string", }, }, @@ -319,7 +319,7 @@ snapshot[`typegate: find available operations 1`] = ` enum: null, format: null, optional: true, - title: "scalar_integer_1", + title: "_prisma_integer_filter_t0_integer", type: "integer", }, }, @@ -333,7 +333,7 @@ snapshot[`typegate: find available operations 1`] = ` enum: null, format: null, optional: true, - title: "scalar_integer_1", + title: "_prisma_integer_filter_t0_integer", type: "integer", }, }, @@ -437,7 +437,7 @@ snapshot[`typegate: find available operations 1`] = ` enum: null, format: null, optional: false, - title: "scalar_integer_1", + title: "_prisma_integer_filter_t0_integer", type: "integer", }, }, @@ -450,7 +450,7 @@ snapshot[`typegate: find available operations 1`] = ` enum: null, format: null, optional: false, - title: "scalar_integer_1", + title: "_prisma_integer_filter_t0_integer", type: "integer", }, }, @@ -463,7 +463,7 @@ snapshot[`typegate: find available operations 1`] = ` enum: null, format: null, optional: false, - title: "scalar_string_1", + title: "_prisma_string_filter_t0_string", type: "string", }, }, @@ -477,7 +477,7 @@ snapshot[`typegate: find available operations 1`] = ` enum: null, format: null, optional: false, - title: "scalar_integer_1", + title: "_prisma_integer_filter_t0_integer", type: "integer", }, }, @@ -505,7 +505,7 @@ snapshot[`typegate: find available operations 1`] = ` enum: null, format: null, optional: false, - title: "scalar_string_1", + title: "_prisma_string_filter_t0_string", type: "string", }, }, @@ -519,7 +519,7 @@ snapshot[`typegate: find available operations 1`] = ` enum: null, format: null, optional: false, - title: "scalar_string_1", + title: "_prisma_string_filter_t0_string", type: "string", }, }, diff --git a/tests/runtimes/wasm_wire/rust/fdk.rs b/tests/runtimes/wasm_wire/rust/fdk.rs index 3b80916fe..b55796287 100644 --- a/tests/runtimes/wasm_wire/rust/fdk.rs +++ b/tests/runtimes/wasm_wire/rust/fdk.rs @@ -219,53 +219,53 @@ macro_rules! init_mat { // gen-static-end use types::*; pub mod types { - pub type ScalarFloat1 = f64; + pub type AddArgsAFloat = f64; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct AddArgs { - pub a: ScalarFloat1, - pub b: ScalarFloat1, + pub a: AddArgsAFloat, + pub b: AddArgsAFloat, } - pub type ScalarInteger1 = i64; - pub type RangeArgsAScalarInteger1Optional = Option; + pub type AddOutput = i64; + pub type RangeArgsAAddOutputOptional = Option; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct RangeArgs { - pub a: RangeArgsAScalarInteger1Optional, - pub b: ScalarInteger1, + pub a: RangeArgsAAddOutputOptional, + pub b: AddOutput, } - pub type RangeOutput = Vec; + pub type RangeOutput = Vec; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct RecordCreationInput { } - pub type ScalarString1 = String; - pub type ScalarStringEnum1 = String; - pub type ScalarStringEnum2 = String; - pub type ProfileAttributesScalarStringEnum2List = Vec; - pub type ScalarStringEnum3 = String; - pub type ProfileCategoryStructValueScalarString1Optional = Option; + pub type EntityNameString = String; + pub type ProfileLevelStringEnum = String; + pub type ProfileAttributesStringEnum = String; + pub type ProfileAttributesProfileAttributesStringEnumList = Vec; + pub type ProfileCategoryStructTagStringEnum = String; + pub type ProfileCategoryStructValueEntityNameStringOptional = Option; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct ProfileCategoryStruct { - pub tag: ScalarStringEnum3, - pub value: ProfileCategoryStructValueScalarString1Optional, + pub tag: ProfileCategoryStructTagStringEnum, + pub value: ProfileCategoryStructValueEntityNameStringOptional, } #[derive(Debug, serde::Serialize, serde::Deserialize)] #[serde(untagged)] pub enum ProfileMetadatasEither { - ScalarString1(ScalarString1), - ScalarFloat1(ScalarFloat1), + EntityNameString(EntityNameString), + AddArgsAFloat(AddArgsAFloat), } pub type ProfileMetadatasProfileMetadatasEitherList = Vec; pub type ProfileMetadatasProfileMetadatasProfileMetadatasEitherListList = Vec; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct Profile { - pub level: ScalarStringEnum1, - pub attributes: ProfileAttributesScalarStringEnum2List, + pub level: ProfileLevelStringEnum, + pub attributes: ProfileAttributesProfileAttributesStringEnumList, pub category: ProfileCategoryStruct, pub metadatas: ProfileMetadatasProfileMetadatasProfileMetadatasEitherListList, } #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct Entity { - pub name: ScalarString1, - pub age: RangeArgsAScalarInteger1Optional, + pub name: EntityNameString, + pub age: RangeArgsAAddOutputOptional, pub profile: Profile, } pub type RecordCreationOutput = Vec; @@ -290,7 +290,7 @@ pub mod stubs { } } - fn handle(&self, input: AddArgs, cx: Ctx) -> anyhow::Result; + fn handle(&self, input: AddArgs, cx: Ctx) -> anyhow::Result; } pub trait Range: Sized + 'static { fn erased(self) -> ErasedHandler {