Skip to content

Commit 2f5aec3

Browse files
committed
Fix list of boolean argument
1 parent 757968e commit 2f5aec3

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

include/graphqlservice/GraphQLClient.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,17 @@ struct ModifiedVariable
168168
response::Value result { response::Type::List };
169169

170170
result.reserve(listValue.size());
171-
std::ranges::for_each(listValue, [&result](auto& value) {
172-
result.emplace_back(serialize<Other...>(std::move(value)));
173-
});
171+
if constexpr(std::is_same_v<Type,bool>){
172+
for (auto const v: listValue)
173+
result.push_back(v);
174+
});
175+
}
176+
else{
177+
std::ranges::for_each(listValue, [&result](auto& value) {
178+
result.emplace_back(serialize<Other...>(std::move(value)));
179+
});
180+
}
181+
174182
listValue.clear();
175183

176184
return result;

include/graphqlservice/GraphQLService.h

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -795,11 +795,18 @@ struct ModifiedArgument
795795
duplicate(const typename ArgumentTraits<Type, Modifier, Other...>::type& listValue)
796796
requires ListModifier<Modifier>
797797
{
798-
typename ArgumentTraits<Type, Modifier, Other...>::type result(listValue.size());
799-
800-
std::ranges::transform(listValue, result.begin(), duplicate<Other...>);
801-
802-
return result;
798+
if constexpr(std::is_same_v<Type,bool>){
799+
typename ArgumentTraits<Type, Modifier, Other...>::type result;
800+
result.reserve(listValue.size());
801+
for (auto const v: listValue)
802+
result.push_back(v);
803+
}
804+
else
805+
{
806+
typename ArgumentTraits<Type, Modifier, Other...>::type result(listValue.size());
807+
std::ranges::transform(listValue, result.begin(), duplicate<Other...>);
808+
return result;
809+
}
803810
}
804811
};
805812

0 commit comments

Comments
 (0)