1414#include " graphqlservice/internal/Grammar.h"
1515#include " graphqlservice/internal/Schema.h"
1616
17+ #include < unordered_set>
18+
1719namespace graphql ::generator {
1820
1921using RequestSchemaType = std::shared_ptr<const schema::BaseType>;
@@ -40,9 +42,18 @@ struct ResponseField
4042 ResponseFieldList children;
4143};
4244
43- struct RequestVariable
45+ struct RequestInputType
4446{
4547 RequestSchemaType type;
48+ std::unordered_set<std::string_view> dependencies {};
49+ std::vector<std::string_view> declarations {};
50+ };
51+
52+ using RequestInputTypeList = std::vector<RequestInputType>;
53+
54+ struct RequestVariable
55+ {
56+ RequestInputType inputType;
4657 TypeModifierStack modifiers;
4758 std::string_view name;
4859 std::string_view cppName;
@@ -76,10 +87,12 @@ class RequestLoader
7687 const ResponseType& getResponseType () const noexcept ;
7788 const RequestVariableList& getVariables () const noexcept ;
7889
79- const RequestSchemaTypeList & getReferencedInputTypes () const noexcept ;
90+ const RequestInputTypeList & getReferencedInputTypes () const noexcept ;
8091 const RequestSchemaTypeList& getReferencedEnums () const noexcept ;
8192
8293 std::string getInputCppType (const RequestSchemaType& wrappedInputType) const noexcept ;
94+ std::string getInputCppType (const RequestSchemaType& inputType,
95+ const TypeModifierStack& modifiers) const noexcept ;
8396 static std::string getOutputCppType (
8497 std::string_view outputCppType, const TypeModifierStack& modifiers) noexcept ;
8598
@@ -99,7 +112,7 @@ class RequestLoader
99112 void collectFragments () noexcept ;
100113 void collectVariables () noexcept ;
101114 void collectInputTypes (const RequestSchemaType& variableType) noexcept ;
102- void reorderInputTypeDependencies () noexcept ;
115+ void reorderInputTypeDependencies ();
103116 void collectEnums (const RequestSchemaType& variableType) noexcept ;
104117 void collectEnums (const ResponseField& responseField) noexcept ;
105118
@@ -146,7 +159,7 @@ class RequestLoader
146159 ResponseType _responseType;
147160 RequestVariableList _variables;
148161 internal::string_view_set _inputTypeNames;
149- RequestSchemaTypeList _referencedInputTypes;
162+ RequestInputTypeList _referencedInputTypes;
150163 internal::string_view_set _enumNames;
151164 RequestSchemaTypeList _referencedEnums;
152165};
0 commit comments