microsoft / microsoft/cppgraphqlgen
Error compiling in resolve function
Open
- Dominant language
- C++
- Stars
- 350
- Forks
- 56
- Avg merge
- 2h 33m
- Merged PRs (30d)
- 3
Description
Hi, i tried compile this schema and getting error in resolve function in versions 4.9.5 and 5.0.0-rc4.
input Type {
input1: Int
}
type ReturnObject {
returnField: String!
}
type Query {
field0(input: Type): String!
field1(input: Type): ReturnObject!
}
in generated schema file QueryObject, has different function signature for input fields, one of them optional and another unique. it depend on scalar or non-scalar returning type for field.
[[nodiscard("unnecessary call")]] virtual service::AwaitableScalar<std::string> getField0(service::FieldParams&& params, std::optional<Type>&& inputArg) const = 0;
[[nodiscard("unnecessary call")]] virtual service::AwaitableObject<std::shared_ptr<ReturnObject>> getField1(service::FieldParams&& params, std::unique_ptr<Type>&& inputArg) const = 0;
This behaviour invoke compile error in resolveField0
service::AwaitableResolver Query::resolveField0(service::ResolverParams&& params) const
{
auto argInput = service::ModifiedArgument<Type>::require<service::TypeModifier::Nullable>("input", params.arguments);
std::unique_lock resolverLock(_resolverMutex);
service::SelectionSetParams selectionSetParams { static_cast<const service::SelectionSetParams&>(params) };
auto directives = std::move(params.fieldDirectives);
auto result = _pimpl->getField0(service::FieldParams { std::move(selectionSetParams), std::move(directives) }, std::move(argInput)); // HERE
resolverLock.unlock();
return service::ModifiedResult<std::string>::convert(std::move(result), std::move(params));
}
Since argInput becomes a unique_ptr, as I see it, it depends on the type of the input parameter for field0
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.