@@ -261,7 +261,7 @@ static_assert(graphql::internal::MinorVersion == )cpp"
261261
262262 headerFile << R"cpp( struct )cpp" << _schemaLoader.getCppType (inputType->name ())
263263 << R"cpp(
264- {
264+ {
265265)cpp" ;
266266
267267 for (const auto & inputField : inputType->inputFields ())
@@ -314,6 +314,11 @@ response::Value serializeVariables(Variables&& variables);
314314 {
315315 pendingSeparator.add ();
316316 }
317+ }
318+
319+ for (const auto & responseField : responseType.fields )
320+ {
321+ pendingSeparator.reset ();
317322
318323 headerFile << R"cpp( )cpp"
319324 << RequestLoader::getOutputCppType (getResponseFieldCppType (responseField),
@@ -401,26 +406,29 @@ bool Generator::outputResponseFieldType(std::ostream& headerFile,
401406 {
402407 pendingSeparator.reset ();
403408
404- if (fieldNames.emplace (field.name ).second )
409+ if (fieldNames.emplace (field.name ).second
410+ && outputResponseFieldType (headerFile, field, indent + 1 ))
405411 {
406- if (outputResponseFieldType (headerFile, field, indent + 1 ))
407- {
408- pendingSeparator.add ();
409- }
412+ pendingSeparator.add ();
413+ }
414+ }
410415
416+ fieldNames.clear ();
417+
418+ for (const auto & field : responseField.children )
419+ {
420+ pendingSeparator.reset ();
421+
422+ if (fieldNames.emplace (field.name ).second )
423+ {
411424 headerFile << indentTabs << R"cpp( )cpp"
412425 << RequestLoader::getOutputCppType (getResponseFieldCppType (field),
413426 field.modifiers )
414427 << 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(
421428)cpp" ;
422429 }
423430 }
431+
424432 break ;
425433 }
426434
@@ -429,7 +437,6 @@ bool Generator::outputResponseFieldType(std::ostream& headerFile,
429437 }
430438
431439 headerFile << indentTabs << R"cpp( };
432-
433440)cpp" ;
434441
435442 return true ;
@@ -507,8 +514,8 @@ using namespace )cpp"
507514 if (!variables.empty ())
508515 {
509516 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)
512519{
513520 response::Value result { response::Type::EnumValue };
514521
@@ -530,8 +537,9 @@ response::Value ModifiedVariable<)cpp" << cppType
530537 const auto cppType = _schemaLoader.getCppType (inputType->name ());
531538
532539 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)
535543{
536544 response::Value result { response::Type::Map };
537545
@@ -565,8 +573,8 @@ response::Value ModifiedVariable<Variables::)cpp" << cppType
565573 const auto cppType = _schemaLoader.getCppType (enumType->name ());
566574
567575 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)
570578{
571579 if (!value.maybe_enum())
572580 {
0 commit comments