@@ -261,7 +261,7 @@ static_assert(graphql::internal::MinorVersion == )cpp"
261
261
262
262
headerFile << R"cpp( struct )cpp" << _schemaLoader.getCppType (inputType->name ())
263
263
<< R"cpp(
264
- {
264
+ {
265
265
)cpp" ;
266
266
267
267
for (const auto & inputField : inputType->inputFields ())
@@ -314,6 +314,11 @@ response::Value serializeVariables(Variables&& variables);
314
314
{
315
315
pendingSeparator.add ();
316
316
}
317
+ }
318
+
319
+ for (const auto & responseField : responseType.fields )
320
+ {
321
+ pendingSeparator.reset ();
317
322
318
323
headerFile << R"cpp( )cpp"
319
324
<< RequestLoader::getOutputCppType (getResponseFieldCppType (responseField),
@@ -401,26 +406,29 @@ bool Generator::outputResponseFieldType(std::ostream& headerFile,
401
406
{
402
407
pendingSeparator.reset ();
403
408
404
- if (fieldNames.emplace (field.name ).second )
409
+ if (fieldNames.emplace (field.name ).second
410
+ && outputResponseFieldType (headerFile, field, indent + 1 ))
405
411
{
406
- if (outputResponseFieldType (headerFile, field, indent + 1 ))
407
- {
408
- pendingSeparator.add ();
409
- }
412
+ pendingSeparator.add ();
413
+ }
414
+ }
410
415
416
+ fieldNames.clear ();
417
+
418
+ for (const auto & field : responseField.children )
419
+ {
420
+ pendingSeparator.reset ();
421
+
422
+ if (fieldNames.emplace (field.name ).second )
423
+ {
411
424
headerFile << indentTabs << R"cpp( )cpp"
412
425
<< RequestLoader::getOutputCppType (getResponseFieldCppType (field),
413
426
field.modifiers )
414
427
<< R"cpp( )cpp" << field.cppName << R"cpp( {};
415
- )cpp" ;
416
- }
417
- else
418
- {
419
- headerFile << indentTabs << R"cpp( // duplicate: )cpp" << field.cppName
420
- << R"cpp(
421
428
)cpp" ;
422
429
}
423
430
}
431
+
424
432
break ;
425
433
}
426
434
@@ -429,7 +437,6 @@ bool Generator::outputResponseFieldType(std::ostream& headerFile,
429
437
}
430
438
431
439
headerFile << indentTabs << R"cpp( };
432
-
433
440
)cpp" ;
434
441
435
442
return true ;
@@ -507,8 +514,8 @@ using namespace )cpp"
507
514
if (!variables.empty ())
508
515
{
509
516
sourceFile << R"cpp( template <>
510
- response::Value ModifiedVariable<)cpp" << cppType
511
- << R"cpp( >::serialize()cpp" << cppType << R"cpp( && value)
517
+ response::Value ModifiedVariable<)cpp"
518
+ << cppType << R"cpp( >::serialize()cpp" << cppType << R"cpp( && value)
512
519
{
513
520
response::Value result { response::Type::EnumValue };
514
521
@@ -530,8 +537,9 @@ response::Value ModifiedVariable<)cpp" << cppType
530
537
const auto cppType = _schemaLoader.getCppType (inputType->name ());
531
538
532
539
sourceFile << R"cpp( template <>
533
- response::Value ModifiedVariable<Variables::)cpp" << cppType
534
- << R"cpp( >::serialize(Variables::)cpp" << cppType << R"cpp( && inputValue)
540
+ response::Value ModifiedVariable<Variables::)cpp"
541
+ << cppType << R"cpp( >::serialize(Variables::)cpp" << cppType
542
+ << R"cpp( && inputValue)
535
543
{
536
544
response::Value result { response::Type::Map };
537
545
@@ -565,8 +573,8 @@ response::Value ModifiedVariable<Variables::)cpp" << cppType
565
573
const auto cppType = _schemaLoader.getCppType (enumType->name ());
566
574
567
575
sourceFile << R"cpp( template <>
568
- )cpp" << cppType << R"cpp( ModifiedResponse<)cpp" << cppType
569
- << R"cpp( >::parse(response::Value&& value)
576
+ )cpp" << cppType << R"cpp( ModifiedResponse<)cpp"
577
+ << cppType << R"cpp( >::parse(response::Value&& value)
570
578
{
571
579
if (!value.maybe_enum())
572
580
{
0 commit comments