Is it possible to define a prefix for classnames f...
# apollo-kotlin
c
Is it possible to define a prefix for classnames for Apollo generated classes?
m
Can you share more about the use case? You can set a package name to avoid nameclashing but that's the only thing so far
I opened https://github.com/apollographql/apollo-kotlin/issues/4026 to brainstorm about possible compiler tweaks
c
Definitely! I was inspired by our usage of
graphql-codegen
on our server. The typescript plugin provides a config option called
typesPrefix
and it will prepend whatever string you give it to each of the generated types. We use it so that the model names from our ORM don't conflict with the names from
graphql-codegen
. All of our graphql types have the prefix
GQL
.
🙏 1
👀 1
Here's a link to the specific config var mentioned above https://www.graphql-code-generator.com/plugins/typescript#usage-examples-24
I have similar naming conflicts on the kotlin side of things which I can work around with aliased imports, but it could be cool to have support for prefixes like this
m
I see, thanks for the details! It shouldn't be too hard to add such an option. What I'm wondering is how much we want a ton of options vs some more general purpose APIs. Options are great and easy but also come with a pretty hefty maintenance and testing cost (and the Options class is starting to get quite big)