Skip to content

Commit 0da6378

Browse files
committed
Move the concrete Introspection object declarations up
1 parent cb56e15 commit 0da6378

File tree

2 files changed

+10
-24
lines changed

2 files changed

+10
-24
lines changed

include/graphqlservice/introspection/IntrospectionSchema.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,14 @@ enum class DirectiveLocation
6767
INPUT_FIELD_DEFINITION
6868
};
6969

70-
namespace object {
71-
7270
class Schema;
7371
class Type;
7472
class Field;
7573
class InputValue;
7674
class EnumValue;
7775
class Directive;
7876

79-
} // namespace object
77+
namespace object {
8078

8179
class Schema;
8280
class Type;
@@ -85,8 +83,6 @@ class InputValue;
8583
class EnumValue;
8684
class Directive;
8785

88-
namespace object {
89-
9086
class Schema
9187
: public service::Object
9288
{

src/SchemaGenerator.cpp

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,14 @@ static_assert(graphql::internal::MinorVersion == )cpp"
254254
{
255255
if (_loader.isIntrospection())
256256
{
257+
// Forward declare all of the concrete types for the Introspection schema
258+
for (const auto& objectType : _loader.getObjectTypes())
259+
{
260+
headerFile << R"cpp(class )cpp" << objectType.cppType << R"cpp(;
261+
)cpp";
262+
}
263+
264+
headerFile << std::endl;
257265
}
258266

259267
objectNamespace.enter();
@@ -308,25 +316,7 @@ static_assert(graphql::internal::MinorVersion == )cpp"
308316

309317
if (!_loader.getObjectTypes().empty() && _options.mergeFiles)
310318
{
311-
if (_loader.isIntrospection())
312-
{
313-
if (objectNamespace.exit())
314-
{
315-
headerFile << std::endl;
316-
}
317-
318-
// Forward declare all of the concrete types for the Introspection schema
319-
for (const auto& objectType : _loader.getObjectTypes())
320-
{
321-
headerFile << R"cpp(class )cpp" << objectType.cppType << R"cpp(;
322-
)cpp";
323-
}
324-
325-
headerFile << std::endl;
326-
objectNamespace.enter();
327-
headerFile << std::endl;
328-
}
329-
else
319+
if (!_loader.isIntrospection())
330320
{
331321
objectNamespace.enter();
332322

0 commit comments

Comments
 (0)