Skip to content

Commit a46c6cb

Browse files
committed
Fix #199
1 parent cee3dd4 commit a46c6cb

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/ClientGenerator.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,8 @@ static_assert(graphql::internal::MinorVersion == )cpp"
206206
{
207207
pendingSeparator.reset();
208208

209-
headerFile << R"cpp(enum class )cpp" << _schemaLoader.getCppType(enumType->name()) << R"cpp(
209+
headerFile << R"cpp(enum class )cpp" << _schemaLoader.getCppType(enumType->name())
210+
<< R"cpp(
210211
{
211212
)cpp";
212213
for (const auto& enumValue : enumType->enumValues())
@@ -605,8 +606,14 @@ response::Value serializeVariables(Variables&& variables)
605606
for (const auto& variable : variables)
606607
{
607608
sourceFile << R"cpp( result.emplace_back(R"js()cpp" << variable.name
608-
<< R"cpp()js"s, ModifiedVariable<Variables::)cpp"
609-
<< _schemaLoader.getCppType(variable.type->name()) << R"cpp(>::serialize)cpp"
609+
<< R"cpp()js"s, ModifiedVariable<)cpp";
610+
611+
if (_schemaLoader.getSchemaType(variable.type->name()) != SchemaType::Scalar)
612+
{
613+
sourceFile << R"cpp(Variables::)cpp";
614+
}
615+
616+
sourceFile << _schemaLoader.getCppType(variable.type->name()) << R"cpp(>::serialize)cpp"
610617
<< getTypeModifierList(variable.modifiers)
611618
<< R"cpp((std::move(variables.)cpp" << variable.cppName << R"cpp()));
612619
)cpp";

0 commit comments

Comments
 (0)