diff --git a/Cargo.lock b/Cargo.lock index 9403e074b1..468168b43e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2827,7 +2827,7 @@ dependencies = [ [[package]] name = "dojo-world-abigen" -version = "0.1.0" +version = "0.4.4" dependencies = [ "cairo-lang-starknet", "camino", diff --git a/crates/torii/graphql/src/schema.rs b/crates/torii/graphql/src/schema.rs index 32db9f090a..1d08bfe0f2 100644 --- a/crates/torii/graphql/src/schema.rs +++ b/crates/torii/graphql/src/schema.rs @@ -2,6 +2,7 @@ use anyhow::Result; use async_graphql::dynamic::{ Field, Object, Scalar, Schema, Subscription, SubscriptionField, Union, }; +use convert_case::{Case, Casing}; use sqlx::SqlitePool; use torii_core::types::Model; @@ -126,7 +127,7 @@ async fn build_objects(pool: &SqlitePool) -> Result<(Vec>, let type_mapping = type_mapping_query(&mut conn, &model.id).await?; if !type_mapping.is_empty() { - let field_name = model.name.to_lowercase(); + let field_name = model.name.to_case(Case::Camel); let type_name = model.name; union = union.possible_type(&type_name); diff --git a/crates/torii/graphql/src/tests/models_test.rs b/crates/torii/graphql/src/tests/models_test.rs index 75e2b7c07b..0798bc62ba 100644 --- a/crates/torii/graphql/src/tests/models_test.rs +++ b/crates/torii/graphql/src/tests/models_test.rs @@ -318,6 +318,21 @@ mod tests { let connection: Connection = serde_json::from_value(records).unwrap(); assert_eq!(connection.edges.len(), 0); + let query = r#" + {{ + recordSiblingModels {{ + edges {{ + cursor + node {{ + __typename + }} + }} + }} + }} + "#; + let result = run_graphql_query(&schema, query).await; + assert!(result.get("recordSiblingsModels").is_some()); + Ok(()) } }