Skip to content

Error compiling in resolve function #354

Description

@JRegener

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions