https://kotlinlang.org logo
Title
j

Jeremie

02/18/2022, 2:16 PM
it doesnt seem to like the multi layer breakdown here, so if i just have this instead it compiles:
fragment ThreeLayerBreakdown on AbstractBreakdown {
    ...TokenBreakdownV3Fragment
}
m

mbonnin

02/18/2022, 2:18 PM
Any chance you can share your schema and queries?
You can mp them if that's easier
j

Jeremie

02/18/2022, 2:40 PM
what does mp mean
so at the very bottom, it doesnt like the second level sub object
so if i remove that one it works
m

mbonnin

02/18/2022, 2:41 PM
what does mp mean
Not sure... I guess I meant pm (private message) 😅 . sorry!
😂 1
🙌 1
j

Jeremie

02/18/2022, 2:42 PM
fragment ThreeLayerBreakdown on AbstractBreakdown {
    ...TokenBreakdownV3Fragment
    breakdown {
        ...TokenBreakdownV3Fragment
    }
}
works but not with an extra layer, but its a recursive object (which could go on infinitely but in this case we are happy with three layers
m

mbonnin

02/18/2022, 2:42 PM
http://pastie.org/p/0MOEG0htSH915YtjZADJCa
Thanks for this. Would you have the matching schema.[json|graphqls] ?
j

Jeremie

02/18/2022, 2:43 PM
ill pm you that 🙂
👍 1
🙏 1
m

mbonnin

02/18/2022, 3:18 PM
For the record, and anyone following that thread, the issue ended up being exponential blowup of the generated code due to many nested fragments. (basically this issue)
The code becomes so large that the compiler doesn't compile it anymore 😅
💥 2
I'll put some monitoring/errors in the codegen so that we can report these cases more accurately
The solution is to use
operationBased
codegen when some queries use a lot of nested fragments. I've looked at this from every angle but I don't think it's possible to have both "direct access syntax" (skipping the fragments accessors) and not generate all possible response shapes
y

Yang

02/22/2022, 12:20 AM
Does flattenModels.set(true) help?
j

Jeremie

02/22/2022, 12:38 AM
Im already commited to operations based but I was curious about flatenModels, it avoids the crash, but gradle seems to hang indefinitely.
😂 2
m

mbonnin

02/22/2022, 1:42 AM
flattenModels.set(true) should not change the amount of code generated. The difference is that classes will all be at the first level instead of being nested. Maybe that's slightly easier for the compiler but that is still huge classes to compile
🙌 1
👍 1