@@ -1506,6 +1506,7 @@ bool Generator::outputHeader() const noexcept
15061506 NamespaceScope graphqlNamespace{ headerFile, " graphql" };
15071507 NamespaceScope introspectionNamespace{ headerFile, s_introspectionNamespace };
15081508 NamespaceScope schemaNamespace{ headerFile, _schemaNamespace, true };
1509+ NamespaceScope objectNamespace{ headerFile, " object" , true };
15091510
15101511 headerFile << R"cpp(
15111512class Schema;
@@ -1599,7 +1600,7 @@ class Schema;
15991600
16001601 if (!_objectTypes.empty ())
16011602 {
1602- NamespaceScope objectNamespace{ headerFile, " object " } ;
1603+ objectNamespace. enter () ;
16031604 headerFile << std::endl;
16041605
16051606 // Forward declare all of the object types
@@ -1614,7 +1615,10 @@ class Schema;
16141615
16151616 if (!_interfaceTypes.empty ())
16161617 {
1617- headerFile << std::endl;
1618+ if (objectNamespace.exit ())
1619+ {
1620+ headerFile << std::endl;
1621+ }
16181622
16191623 // Forward declare all of the interface types
16201624 if (_interfaceTypes.size () > 1 )
@@ -1648,16 +1652,21 @@ class Schema;
16481652
16491653 if (!_objectTypes.empty () && !_options.separateFiles )
16501654 {
1651- NamespaceScope objectNamespace{ headerFile, " object" };
1652- headerFile << std::endl;
1655+ if (objectNamespace.enter ())
1656+ {
1657+ headerFile << std::endl;
1658+ }
16531659
16541660 // Output the full declarations
16551661 for (const auto & objectType : _objectTypes)
16561662 {
16571663 outputObjectDeclaration (headerFile, objectType, objectType.type == queryType);
16581664 headerFile << std::endl;
16591665 }
1666+ }
16601667
1668+ if (objectNamespace.exit ())
1669+ {
16611670 headerFile << std::endl;
16621671 }
16631672
@@ -1667,8 +1676,7 @@ class Schema;
16671676 {
16681677 bool firstOperation = true ;
16691678
1670- headerFile << R"cpp(
1671- class Operations
1679+ headerFile << R"cpp( class Operations
16721680 : public service::Request
16731681{
16741682public:
0 commit comments