-
-
Notifications
You must be signed in to change notification settings - Fork 250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Broken Fragment resolving #2538
Comments
Sure, sorry for the delay! |
2.9.0 seems to have the same issue., which suggests the change you highlighted might be the issue, ill try to publish local with it removed and see if it works |
@dispalt I can't seem to be able to reproduce the issue. I tried adding this test but it's passing: test("nested fragment selection on the same type") {
case class A(valueA: String)
case class B(valueB: String)
case class Foo(a: A, b: B)
case class Query(foo: Foo)
implicit val schemaQuery: Schema[Any, Query] = Schema.gen
val api = graphQL(RootResolver(Query(Foo(A("a"), B("b")))))
val q = gqldoc("""
fragment FragA on Query {
foo {
a {
valueA
}
}
}
fragment FragB on Query {
foo {
b {
valueB
}
}
}
query {
...FragA
...FragB
}
""")
api.interpreterUnsafe.execute(q).map { res =>
val d = res.data.toString
assertTrue(d == """{"foo":{"a":{"valueA":"a"},"b":{"valueB":"b"}}}""")
}
} Would you be able to provide a reproducer that fails the test above so I can look into it? |
Try this test("nested fragment selection on the same type") {
import caliban.schema.Schema.auto._
case class A(valueA: String, valueC: String)
case class B(valueB: String)
case class Foo(a: A, b: B)
case class Query(foo: Foo)
val api = graphQL(RootResolver(Query(Foo(A("a", "c"), B("b")))))
val q = gqldoc("""
fragment FragA on Query {
foo {
a {
valueA
valueC
}
}
}
fragment FragB on Query {
foo {
a {
valueA
}
b {
valueB
}
}
}
query {
...FragA
...FragB
}
""")
api.interpreterUnsafe.execute(q).map { res =>
val d = res.data.toString
assertTrue(d == """{"foo":{"a":{"valueA":"a","valueC":"c"},"b":{"valueB":"b"}}}""")
}
} returns {"foo":{"a":{"valueA":"a","valueC":"c"},"a":{"valueA":"a"},"b":{"valueB":"b"}}} |
yep this is exactly what I was seeing testing, thank you for the primer test case, @kyri-petrou |
I think it's related to this. #2491
Previously this used to work and now it doesn't, it will return only
crux
orcrux2
, starting with 2.9.1, I didn't test2.9.0
I jumped from2.8.1
to2.9.1
and it broke. It's easy to reproduce on my production code, Ill see if I can work on a test case in the repo later today or tomorrow.It seems to only show up after a certain amount of nesting.
Edited: Changed
crux2
tocrux
The text was updated successfully, but these errors were encountered: