Is there a way to force generation of a type from ...
# apollo-kotlin
s
Is there a way to force generation of a type from the graphqls schema while it is not mentioned in any of the queries? My use case is that we have a
Locale
specified as a type with the specific string values that our backend accepts in the schema, and I want to use that in my local code in order to make sure I am not sending in a wrong string. The queries themselves accept a String type, but I can use that type
Copy code
enum Locale {
  sv_SE
  en_SE
  ... # more here
}
to use it typed in my code, and then extract the rawValue at the last moment to pass it to the query. But the thing is, if none of the
.graphql
files mention this type, it’s not generated automatically.
m
There's a
alwaysGenerateTypesMatching
Gradle option
Copy code
apollo {
  alwaysGenerateTypesMatching.set(listOf("Locale"))
}
s
Amazing, that’s exactly what I was looking for. Thanks a ton!
m
Sure thing!