Stylianos Gakis
05/27/2022, 11:25 PM"variables" to resolve("variables", some type, emptyList(), { ctors here })
and the list of constructors is of all the possible things this could be. But some of those alternatives are builders that require the __typename to be specified, so it crashes when it tries to resolve them all. I then need to go back that stacktrace and find the last reference to my code to see which field it is that I need to define but isn’t there.
Where this happens is places where there is a field which inside the generated builder has the type List<Map<String, Any?>>
, so it’s not nullable and it needs to be specified. (The type inside the schema is [SomeType!]!.
I am sure I’ve not explained this very well, but just wanted to type it out here for now and if it makes sense to you that’d be awesome, if not I will try to make a better explanation some other day 😅Stylianos Gakis
05/29/2022, 10:11 AMList<Map<String, Any?>>
, because I’ve seen it in a normal Map<String, Any?>?
as well. It probably comes from the behavior of the test builders trying to fill some defaults for the not-specified variables. And in this effort I guess from all the different things that are passed as ctors
in the resolve function some of them call builders which crash if they don’t have a __typename provided to them.
As a side-note the fact that Lists specifically try to fill with 3 values did catch me super off-guard as I couldn’t understand where I was specifying that in my test builder. I initially thought it’d simply be an emptyList. In hindsight I don’t think it’s a bad idea for the default resolver though. Maybe worth a mention in the docs? If maybe you hear more people feeling that that was an unexpected behavior.bod
05/30/2022, 8:25 AMYourType: __typename is not known at compile-time for this type. Please specify it explicitly
?bod
05/30/2022, 8:32 AMStylianos Gakis
05/30/2022, 8:56 AMbod
05/30/2022, 8:57 AMStylianos Gakis
05/30/2022, 9:06 AMDefaultTestResolver()
and override it with one that returns a list size of 0 instead of 3 to avoid most of them. And for those who aren’t lists still have to manually fix those. Makes me think again whether the 3 items as a default is a good default, I wonder what your opinions are on this.
Does this make any more sense?bod
05/30/2022, 9:15 AMmbonnin
05/30/2022, 9:19 AMmbonnin
05/30/2022, 9:19 AMbod
05/30/2022, 9:20 AMmbonnin
05/30/2022, 9:22 AMHero.Data {
character = droid { ... }
// or
// character = human { ... }
}
but this case doesn't exist anymore:
Hero.Data {
character = character {
// cannot determine typename
...
}
}
bod
05/30/2022, 11:12 AMStylianos Gakis
05/30/2022, 11:20 AM