@@ -126,6 +126,7 @@ fn ast_to_prop_value(
126126 found_in_union : bool ,
127127 found_in_array : bool ,
128128 context : & Context ,
129+ is_from_result : bool
129130) -> Option < PropValue > {
130131 let ( nullable, value) = unwrap_ast ( ast) ;
131132 let is_nullable = nullable || optional;
@@ -173,27 +174,19 @@ fn ast_to_prop_value(
173174 found_in_union,
174175 found_in_array,
175176 context,
177+ true
176178 ) ;
177-
178- let mut at_path_for_result = current_path. clone ( ) ;
179- at_path_for_result. push ( key. to_string ( ) ) ;
180179
181180 match ok_prop_value {
182181 None => None ,
183182 Some ( prop_value) => {
184- state. conversion_instructions . push ( InstructionContainer {
185- context : context. clone ( ) ,
186- at_path : at_path_for_result,
187- instruction : ConverterInstructions :: IsResult ,
188- } ) ;
189-
190183 Some ( PropValue {
191- key : safe_key,
192- original_key,
193- comment : None ,
194- nullable : is_nullable,
195- prop_type : Box :: new ( PropType :: Result ( prop_value. prop_type ) )
196- } )
184+ key : safe_key,
185+ original_key,
186+ comment : None ,
187+ nullable : is_nullable,
188+ prop_type : Box :: new ( PropType :: Result ( prop_value. prop_type ) )
189+ } )
197190 }
198191 }
199192
@@ -252,6 +245,7 @@ fn ast_to_prop_value(
252245 found_in_union,
253246 true ,
254247 context,
248+ is_from_result
255249 ) {
256250 None => {
257251 warn ! ( "Could not extract type from array. This should not happen." ) ;
@@ -272,6 +266,11 @@ fn ast_to_prop_value(
272266 AST :: ExactObject ( props) => {
273267 let mut new_at_path = current_path. clone ( ) ;
274268 new_at_path. push ( key. to_string ( ) ) ;
269+
270+ if is_from_result {
271+ new_at_path. push ( String :: from ( "value" ) ) ;
272+ }
273+
275274 let record_name = path_to_name ( & new_at_path) ;
276275
277276 let object_props = get_object_props ( state, & new_at_path, props, found_in_union, context) ;
@@ -323,6 +322,10 @@ fn ast_to_prop_value(
323322 let mut new_at_path = current_path. clone ( ) ;
324323 new_at_path. push ( key. to_string ( ) ) ;
325324
325+ if is_from_result {
326+ new_at_path. push ( String :: from ( "value" ) ) ;
327+ }
328+
326329 let ( union_members, include_catch_all) = extract_union_members ( state, & new_at_path, members, context) ;
327330
328331 let union_record_name = path_to_name ( & new_at_path) ;
@@ -360,9 +363,6 @@ fn ast_to_prop_value(
360363 prop_type : Box :: new ( PropType :: Enum ( full_enum. name . to_string ( ) ) ) ,
361364 } ) ,
362365 ClassifiedIdentifier :: InputObject ( ( input_object_record_name, _) ) => {
363- let mut new_at_path = current_path. clone ( ) ;
364- new_at_path. push ( key. to_string ( ) ) ;
365-
366366 Some ( PropValue {
367367 key : safe_key,
368368 original_key,
@@ -376,6 +376,11 @@ fn ast_to_prop_value(
376376 ClassifiedIdentifier :: RawIdentifier ( identifier) => {
377377 let mut new_at_path = current_path. clone ( ) ;
378378 new_at_path. push ( key. to_string ( ) ) ;
379+
380+ if is_from_result {
381+ new_at_path. push ( String :: from ( "value" ) ) ;
382+ }
383+
379384 let mut is_custom_scalar_that_needs_conversion = false ;
380385
381386 // Add a conversion instruction if this is a custom type
@@ -573,6 +578,7 @@ fn get_object_props(
573578 found_in_union,
574579 false ,
575580 context,
581+ false
576582 )
577583 }
578584 & Prop :: KeyValuePair ( key_value_pair) => {
@@ -653,6 +659,7 @@ fn get_object_props(
653659 found_in_union,
654660 false ,
655661 context,
662+ false
656663 )
657664 }
658665 }
0 commit comments