@@ -84,30 +84,32 @@ struct [[nodiscard("unnecessary construction")]] RequestOptions
8484 const std::string requestFilename;
8585 const std::optional<std::string> operationName;
8686 const bool noIntrospection = false ;
87+ const bool sharedTypes = false ;
8788};
8889
8990class SchemaLoader ;
9091
9192class [[nodiscard(" unnecessary construction" )]] RequestLoader
9293{
9394public:
94- explicit RequestLoader (RequestOptions && requestOptions, const SchemaLoader& schemaLoader);
95+ explicit RequestLoader (RequestOptions&& requestOptions, const SchemaLoader& schemaLoader);
9596
9697 [[nodiscard (" unnecessary call" )]] std::string_view getRequestFilename () const noexcept ;
9798 [[nodiscard (" unnecessary call" )]] const OperationList& getOperations () const noexcept ;
9899 [[nodiscard (" unnecessary call" )]] std::string_view getOperationDisplayName (
99100 const Operation& operation) const noexcept ;
100- [[nodiscard (" unnecessary call" )]] std::string getOperationNamespace (const Operation& operation)
101- const noexcept ;
102- [[nodiscard (" unnecessary call" )]] std::string_view getOperationType (const Operation& operation)
103- const noexcept ;
101+ [[nodiscard (" unnecessary call" )]] std::string getOperationNamespace (
102+ const Operation& operation) const noexcept ;
103+ [[nodiscard (" unnecessary call" )]] std::string_view getOperationType (
104+ const Operation& operation) const noexcept ;
104105 [[nodiscard (" unnecessary call" )]] std::string_view getRequestText () const noexcept ;
105106
106107 [[nodiscard (" unnecessary call" )]] const ResponseType& getResponseType (
107108 const Operation& operation) const noexcept ;
108109 [[nodiscard (" unnecessary call" )]] const RequestVariableList& getVariables (
109110 const Operation& operation) const noexcept ;
110111
112+ [[nodiscard (" unnecessary call" )]] bool useSharedTypes () const noexcept ;
111113 [[nodiscard (" unnecessary call" )]] const RequestInputTypeList& getReferencedInputTypes (
112114 const Operation& operation) const noexcept ;
113115 [[nodiscard (" unnecessary call" )]] const RequestSchemaTypeList& getReferencedEnums (
@@ -116,32 +118,30 @@ class [[nodiscard("unnecessary construction")]] RequestLoader
116118 [[nodiscard (" unnecessary call" )]] std::string getInputCppType (
117119 const RequestSchemaType& wrappedInputType) const noexcept ;
118120 [[nodiscard (" unnecessary call" )]] std::string getInputCppType (
119- const RequestSchemaType& inputType,
120- const TypeModifierStack& modifiers) const noexcept ;
121+ const RequestSchemaType& inputType, const TypeModifierStack& modifiers) const noexcept ;
121122 [[nodiscard (" unnecessary call" )]] static std::string getOutputCppType (
122- std::string_view outputCppType,
123- const TypeModifierStack& modifiers) noexcept ;
123+ std::string_view outputCppType, const TypeModifierStack& modifiers) noexcept ;
124124
125125 [[nodiscard (" unnecessary call" )]] static std::pair<RequestSchemaType, TypeModifierStack>
126- unwrapSchemaType (RequestSchemaType && type) noexcept ;
126+ unwrapSchemaType (RequestSchemaType&& type) noexcept ;
127127
128128private:
129129 void buildSchema ();
130130 void addTypesToSchema ();
131- [[nodiscard (" unnecessary call" )]] RequestSchemaType getSchemaType (std::string_view type,
132- const TypeModifierStack& modifiers) const noexcept ;
131+ [[nodiscard (" unnecessary call" )]] RequestSchemaType getSchemaType (
132+ std::string_view type, const TypeModifierStack& modifiers) const noexcept ;
133133 void validateRequest () const ;
134134
135135 [[nodiscard (" unnecessary call" )]] static std::string_view trimWhitespace (
136136 std::string_view content) noexcept ;
137137
138138 void findOperation ();
139139 void collectFragments () noexcept ;
140- void collectVariables (Operation & operation) noexcept ;
141- void collectInputTypes (Operation & operation, const RequestSchemaType& variableType) noexcept ;
142- void reorderInputTypeDependencies (Operation & operation);
143- void collectEnums (Operation & operation, const RequestSchemaType& variableType) noexcept ;
144- void collectEnums (Operation & operation, const ResponseField& responseField) noexcept ;
140+ void collectVariables (Operation& operation) noexcept ;
141+ void collectInputTypes (Operation& operation, const RequestSchemaType& variableType) noexcept ;
142+ void reorderInputTypeDependencies (Operation& operation);
143+ void collectEnums (Operation& operation, const RequestSchemaType& variableType) noexcept ;
144+ void collectEnums (Operation& operation, const ResponseField& responseField) noexcept ;
145145
146146 using FragmentDefinitionMap = std::map<std::string_view, const peg::ast_node*>;
147147
@@ -150,8 +150,7 @@ class [[nodiscard("unnecessary construction")]] RequestLoader
150150 {
151151 public:
152152 explicit SelectionVisitor (const SchemaLoader& schemaLoader,
153- const FragmentDefinitionMap& fragments,
154- const std::shared_ptr<schema::Schema>& schema,
153+ const FragmentDefinitionMap& fragments, const std::shared_ptr<schema::Schema>& schema,
155154 const RequestSchemaType& type);
156155
157156 void visit (const peg::ast_node& selection);
@@ -163,7 +162,7 @@ class [[nodiscard("unnecessary construction")]] RequestLoader
163162 void visitFragmentSpread (const peg::ast_node& fragmentSpread);
164163 void visitInlineFragment (const peg::ast_node& inlineFragment);
165164
166- void mergeFragmentFields (ResponseFieldList && fragmentFields) noexcept ;
165+ void mergeFragmentFields (ResponseFieldList&& fragmentFields) noexcept ;
167166
168167 const SchemaLoader& _schemaLoader;
169168 const FragmentDefinitionMap& _fragments;
0 commit comments