Error compiling in resolve function

オープン
#354 コメント 0 件 リアクション 1 件 担当者 2 名 GitHub で見る

@wravery がすでに取り組んでいます。

2026年9月15日 から。

  • #364 @copilot-swe-agent による — オープン

評価

この issue はまだ評価されていません。

説明

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

主要言語
C++
スター
350
フォーク
56
平均マージ
2時間 33分
マージ済み PR(30日)
3

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/cppgraphqlgen のほかの issue

microsoft/cppgraphqlgen の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。