Hello! Due to an unfortunate decision in the past,...
# apollo-kotlin
e
Hello! Due to an unfortunate decision in the past, we have an enum value with the name
UNKNOWN__
, meaning that now we can't switch that enum to use a sealed class in Kotlin, because of the name clash between the object and the class 🤦 What would be the easiest/fastest way to change the generated classes' name to something else, to avoid the conflict? Is a compiler hook the only way?
s
I bet the name “UNKNOWN__” was picked in apollo-kotlin because everyone was thinking that surely nobody would have named something that, so there is no way this ever breaks anybody 😂 And here you come to break that assumption
m
It was a pretty bad decission in retrospect, the
__
should have been at the beginning (GraphQL has reserved all identifiers that start with
__
)
k
Copy code
import apollo.blah.UNKNOWN__ as ApolloUnknown
Would that work?
m
There's
@targetName
for those cases, let me check
k
Oh I see, the enum is named unknown in their graphql schema. I misunderstood.
m
There's an example here
e
Whatever the name Apollo would've picked, we'd have used the same. This was a really bad way to handle on our backend unknown enums sent as an input from old clients 🤦‍♂️
I'll have a look, thanks!
👍 1
It worked!!!!! Thank you so much, that was so easy 🙂 And I got so many replies in such a short timeframe. This community never ceases to amaze me apollo ❤️
❤️ 3
🎉 1