File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
graphql_client_codegen/src Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change
1
+ use crate :: codegen_options:: * ;
1
2
use heck:: * ;
2
3
use proc_macro2:: { Ident , Span , TokenStream } ;
3
4
@@ -43,7 +44,15 @@ impl<'a> GeneratedModule<'a> {
43
44
let query_string = & self . query_string ;
44
45
let impls = self . build_impls ( ) ?;
45
46
47
+ let struct_declaration = match self . options . mode {
48
+ CodegenMode :: Cli => quote ! ( #module_visibility struct #operation_name_ident) ,
49
+ // The struct is already present in derive mode.
50
+ CodegenMode :: Derive => quote ! ( ) ,
51
+ } ;
52
+
46
53
Ok ( quote ! (
54
+ #struct_declaration
55
+
47
56
#module_visibility mod #module_name {
48
57
#![ allow( non_camel_case_types) ]
49
58
#![ allow( non_snake_case) ]
Original file line number Diff line number Diff line change @@ -39,10 +39,7 @@ impl<'query> Operation<'query> {
39
39
}
40
40
41
41
/// Generate the Variables struct and all the necessary supporting code.
42
- pub ( crate ) fn expand_variables (
43
- & self ,
44
- context : & QueryContext ,
45
- ) -> TokenStream {
42
+ pub ( crate ) fn expand_variables ( & self , context : & QueryContext ) -> TokenStream {
46
43
let variables = & self . variables ;
47
44
let variables_derives = context. variables_derives ( ) ;
48
45
You can’t perform that action at this time.
0 commit comments