Hi everyone. I have a question: our scheme contain...
# apollo-kotlin
v
Hi everyone. I have a question: our scheme contains an enum with the
type
value. But apollo-kotlin generates the
type
field inside the companion object and inserts it in
knownValues()
. Is there a way to avoid/ignore it, cause the project doesn't compile in this case? Version - 3.3.0
m
Can you file a bug? We'll fix it in apollo and/or kotlinpoet.
In the meantime, a workaround is to remove the enum value from your schema
If you need to access it, you can use
sealedClassesForEnumsMatching.set(listOf("ListCars.*"))
and use 'rawValue' to check 'type'
v
Sure, thanks, I'll file a bug
@mbonnin actually, I mentioned it here https://github.com/apollographql/apollo-kotlin/issues/4023. Will it be enough?
m
Yep that'll do 👍 thanks!
v
@mbonnin sealed classes don't work either...
m
Yea you'll need to remove the 'type' enum value ftom schema[.json|.sdl] in all cases
What sealed classes bring is the ability to use 'type'as a runtime thing (vs a codegen thing)
v
in my project, I have only
schema.graphql
. And if I remove something from there then everything breaks.
b
Hey @Vsevolod Kaganovych 👋 What do you mean by everything breaks? 🙂 You should be able to remove the
type
value from the specified
ListCarsSortingFields
enum in the schema, it will be as if this value doesn't exist and the codegen won't include it
v
My bad, it was due to another issue not related to this. Yes, it worked, thanks a lot!
👍 1