@@ -10,7 +10,7 @@ use cynic_introspection::{
1010 Directive , DirectiveLocation , FieldWrapping , InputValue , InterfaceType , IntrospectionQuery ,
1111 Type , UnionType , WrappingType ,
1212} ;
13- use stringcase:: { kebab_case, pascal_case } ;
13+ use stringcase:: { kebab_case} ;
1414use tokio:: task:: spawn_blocking;
1515
1616use crate :: {
@@ -26,6 +26,7 @@ use crate::{
2626 purescript_record:: { show_field_name, Field , PurescriptRecord } ,
2727 purescript_type:: PurescriptType ,
2828 purescript_variant:: Variant ,
29+ upper_first:: * ,
2930 } ,
3031 write:: write,
3132} ;
@@ -98,7 +99,7 @@ pub async fn build_schema(
9899 let query_type = PurescriptType :: new (
99100 "Query" ,
100101 vec ! [ ] ,
101- Argument :: new_type ( & pascal_case ( schema. query_type . as_str ( ) ) ) ,
102+ Argument :: new_type ( & upper_first ( schema. query_type . as_str ( ) ) ) ,
102103 ) ;
103104 schema_record. add_field ( Field :: new ( "query" ) . with_type ( & query_type. name ) ) ;
104105 types. push ( query_type) ;
@@ -113,7 +114,7 @@ pub async fn build_schema(
113114 let mutation_type = PurescriptType :: new (
114115 "Mutation" ,
115116 vec ! [ ] ,
116- Argument :: new_type ( & pascal_case ( & mut_type) ) ,
117+ Argument :: new_type ( & upper_first ( & mut_type) ) ,
117118 ) ;
118119 schema_record. add_field ( Field :: new ( "mutation" ) . with_type ( & mutation_type. name ) ) ;
119120 types. push ( mutation_type) ;
@@ -124,7 +125,7 @@ pub async fn build_schema(
124125 let mutation_type = PurescriptType :: new (
125126 "Subscription" ,
126127 vec ! [ ] ,
127- Argument :: new_type ( & pascal_case ( & mut_type) ) ,
128+ Argument :: new_type ( & upper_first ( & mut_type) ) ,
128129 ) ;
129130 schema_record. add_field ( Field :: new ( "subscription" ) . with_type ( & mutation_type. name ) ) ;
130131 types. push ( mutation_type) ;
@@ -139,7 +140,7 @@ pub async fn build_schema(
139140 }
140141
141142 // Convert the gql_type_name to a PurescriptTypeName
142- let name = pascal_case ( & obj. name ) ;
143+ let name = upper_first ( & obj. name ) ;
143144
144145 // Creates a new record for the object
145146 let mut record = PurescriptRecord :: new ( "Ignored" ) ;
@@ -214,6 +215,7 @@ pub async fn build_schema(
214215 add_import ( "argonaut-core" , "Data.Argonaut.Core" , "Json" , & mut imports)
215216 }
216217 "time" => add_import ( "datetime" , "Data.Time" , "Time" , & mut imports) ,
218+ "ID" => add_import ( "graphql-client" , "GraphQL.Client.ID" , "ID" , & mut imports) ,
217219 _ => { }
218220 }
219221 }
@@ -239,7 +241,7 @@ pub async fn build_schema(
239241 }
240242
241243 // Convert the gql_type_name to a PurescriptTypeName
242- let name = pascal_case ( & obj. name ) ;
244+ let name = upper_first ( & obj. name ) ;
243245
244246 // Build a purescript record with all fields
245247 let mut record = PurescriptRecord :: new ( "Query" ) ;
@@ -302,7 +304,7 @@ pub async fn build_schema(
302304 union. with_values (
303305 & possible_types
304306 . iter ( )
305- . map ( |t| ( t. clone ( ) , pascal_case ( & t) ) )
307+ . map ( |t| ( t. clone ( ) , upper_first ( & t) ) )
306308 . collect ( ) ,
307309 ) ;
308310
0 commit comments