graphql-ruby icon indicating copy to clipboard operation
graphql-ruby copied to clipboard

argument not defined on connection_type when lazy load

Open yk-eta opened this issue 4 months ago • 1 comments

Describe the bug argument not defined on connection_type when lazy load

Versions graphql: 2.5.11 rails: 8.0.2

GraphQL schema

class Resolver::Test < Resolver::Base
   type Interface::TestInterface
end

module Interface::TestInterface
  field: field1, "test" do
     type Type::Test.connection_type
  end
end

GraphQL query

Example GraphQL query and response (if query execution is involved)

query test {
  test {
    field1(first: 1) { something }
  }
}
"errors": [
    {
      "message": "Field 'replies' doesn't accept argument 'first'",
      "locations": [
        {
          "line": 64,
          "column": 7
        }
      ],
      "path": [
        "query test",
        "test",
        "field1",
        "first"
      ],
      "extensions": {
        "code": "argumentNotAccepted",
        "name": "field1",
        "typeName": "Field",
        "argumentName": "first"
      }
    }
]

yk-eta avatar Aug 22 '25 04:08 yk-eta

Hey, thanks for the detailed report -- I'll take a look soon and follow up here!

rmosolgo avatar Aug 26 '25 09:08 rmosolgo

👋 I made some time to investigate this issue. I think GraphQL-Ruby is confused by the second argument to field ..., which is "test" in the example code above. It's in place of the type argument, but obviously not a type definition.

I think this example will work if you move "test". Do you mean for that to be the description? If so, use description: "test" instead. Otherwise, remove that argument entirely.

I added a test to GraphQL-Ruby demonstrating how this is supposed to work in #5485.

Does moving (or removing) "test" work for you?

rmosolgo avatar Dec 11 '25 15:12 rmosolgo