File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ fn build_graphql_client_derive_options(
70
70
) -> Result < GraphQLClientCodegenOptions , BoxError > {
71
71
let variables_derives = attributes:: extract_attr ( input, "variables_derives" ) . ok ( ) ;
72
72
let response_derives = attributes:: extract_attr ( input, "response_derives" ) . ok ( ) ;
73
+ let custom_scalars_module = attributes:: extract_attr ( input, "custom_scalars_module" ) . ok ( ) ;
73
74
74
75
let mut options = GraphQLClientCodegenOptions :: new ( CodegenMode :: Derive ) ;
75
76
options. set_query_file ( query_path) ;
@@ -92,6 +93,18 @@ fn build_graphql_client_derive_options(
92
93
options. set_normalization ( normalization) ;
93
94
} ;
94
95
96
+ // The user can give a path to a module that provides definitions for the custom scalars.
97
+ if let Some ( custom_scalars_module) = custom_scalars_module {
98
+ let custom_scalars_module = syn:: parse_str ( & custom_scalars_module) . map_err ( |err| {
99
+ GeneralError ( format ! (
100
+ "Invalid custom scalars module path: {}. {}" ,
101
+ custom_scalars_module, err
102
+ ) )
103
+ } ) ?;
104
+
105
+ options. set_custom_scalars_module ( custom_scalars_module) ;
106
+ }
107
+
95
108
options. set_struct_ident ( input. ident . clone ( ) ) ;
96
109
options. set_module_visibility ( input. vis . clone ( ) ) ;
97
110
options. set_operation_name ( input. ident . to_string ( ) ) ;
You can’t perform that action at this time.
0 commit comments