microsoft / microsoft/cppgraphqlgen

Error compiling in resolve function

Open
#354 0 comments 1 reaction 2 assignees View on GitHub

@wravery is already working on this.

Since Sep 15, 2026.

  • #364 by @copilot-swe-agent — 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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.