https://kotlinlang.org logo
Title
s

Stylianos Gakis

05/18/2022, 3:47 PM
Hey got a potential bug, don’t have a nice reproducible build atm to show you, but I can ask it to see if from the top of your head you know that something changed in that part of the code, if not I can try and get something to show you. Using testBuilders, I get generated code that is red. Specifically on a generated file, a testBuilder on a enum turned into a sealed class. Got an enum like
enum CrossSellType {FOO \n BAR}
. Apollo {} is configured with
sealedClassesForEnumsMatching.set(listOf("CrossSellType", ...))
and then the generated code looks like this
"type" to resolve("type", CrossSellType.type.notNull(), knownValues().map { it.name }),
. Problem is, knownValues() returns a list of <CrossSellType> which is in fact a sealed class now, not an enum, so
.name
isn’t resolving, it’s red. On Apollo 3.3.0 rn, can’t really test earlier versions as a lot of other things will be red.
And yes, removing the type from
sealedClassesForEnumsMatching
does produce a TestBuilder without errors.
b

bod

05/18/2022, 3:49 PM
👀 let me see if I can reproduce it!
:party-parrot: 1
yes I can
🎉 1
I guess
rawValue
should be used in that case
or in all cases actually
s

Stylianos Gakis

05/18/2022, 4:13 PM
Yeah good point
rawValue
is available for the Enums as well
b

bod

05/18/2022, 5:15 PM
Thanks a lot for finding and reporting it! 🙏 A fix is here. Unfortunately in the meantime I can't think of a workaround (except of course keeping generating an enum).
😍 1
s

Stylianos Gakis

05/18/2022, 7:23 PM
Amazing, thank you so much! I guess this is a perfect time I can try using a snapshot for the first time. How often are those generated? I see the latest snapshot was at "Wed May 18 18:48:59 UTC 2022". Not sure if this fix is included in there, if not, how often is that generated?
b

bod

05/18/2022, 7:29 PM
Oh yeah they're pushed as soon as a branch is merged on the
main
branch, so they should be available.
🙌 1