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
mbonnin
02/23/2022, 10:32 AM
There's a
alwaysGenerateTypesMatching
Gradle option
mbonnin
02/23/2022, 10:33 AM
Copy code
apollo {
alwaysGenerateTypesMatching.set(listOf("Locale"))
}
s
Stylianos Gakis
02/23/2022, 10:33 AM
Amazing, that’s exactly what I was looking for. Thanks a ton!