File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -146,6 +146,12 @@ static_assert(graphql::internal::MinorVersion == )cpp"
146146 }
147147 }
148148
149+ headerFile << R"cpp(
150+
151+ using namespace std::literals;
152+
153+ )cpp" ;
154+
149155 if (!_loader.getEnumTypes ().empty ())
150156 {
151157 pendingSeparator.reset ();
@@ -173,6 +179,30 @@ static_assert(graphql::internal::MinorVersion == )cpp"
173179};
174180
175181)cpp" ;
182+ firstValue = true ;
183+
184+ headerFile << R"cpp( constexpr std::array<std::string_view, )cpp"
185+ << enumType.values .size () << R"cpp( > namesArray)cpp" << enumType.cppType
186+ << R"cpp( = {
187+ )cpp" ;
188+
189+ for (const auto & value : enumType.values )
190+ {
191+ if (!firstValue)
192+ {
193+ headerFile << R"cpp( ,
194+ )cpp" ;
195+ }
196+
197+ firstValue = false ;
198+ headerFile << R"cpp( R"gql()cpp" << value.value << R"cpp( )gql"sv)cpp" ;
199+ }
200+
201+ headerFile << R"cpp(
202+ };
203+
204+ )cpp" ;
205+
176206 }
177207 }
178208
@@ -964,6 +994,10 @@ void Generator::outputObjectDeclaration(
964994 << R"cpp( service::TypeNames getTypeNames() const noexcept;
965995 service::ResolverMap getResolvers() const noexcept;
966996
997+ constexpr static std::string_view static_typename = std::string_view(
998+ ")cpp" << objectType.type << R"cpp( "
999+ );
1000+
9671001 void beginSelectionSet(const service::SelectionSetParams& params) const final;
9681002 void endSelectionSet(const service::SelectionSetParams& params) const final;
9691003
You can’t perform that action at this time.
0 commit comments