Justin
03/11/2022, 5:54 PMmyschema.graphql
schema file as input and output a collection of kotlin files containing kotlin data classes for that schema?
For example, this GraphQL schema:
myschema.graphql
type User {
"""
The unique identifier for the user
"""
id: String!
"""
User first and last name
"""
name: String!
"""
Gender identity of user
"""
gender: Gender
}
enum Gender {
MALE
FEMALE
OTHER
UNKNOWN
}
...would generate:
User.kt
data class User(
val id: String,
val name: String,
val gender: Gender
)
Gender.kt
enum class Gender {
MALE, FEMALE, OTHER, UNKNOWN;
}
Big Chungus
03/11/2022, 5:55 PMmbonnin
03/11/2022, 5:58 PMmbonnin
03/11/2022, 5:58 PMmbonnin
03/11/2022, 5:59 PMDariusz Kuc
03/11/2022, 6:00 PMapollo-kotlin
we habe codegen for queriesJustin
03/11/2022, 6:00 PMDariusz Kuc
03/11/2022, 6:00 PMnetflix-dgs
has some schema codegen capability but unsure how good/bad it isJustin
03/11/2022, 6:01 PMJustin
03/11/2022, 6:02 PMmbonnin
03/11/2022, 6:03 PMJustin
03/11/2022, 6:04 PMJustin
03/11/2022, 6:05 PMJustin
03/11/2022, 6:08 PMJustin
03/11/2022, 6:08 PMmbonnin
03/11/2022, 6:11 PMquery GetUser {
user {
id
name
# do not query gender
# gender
}
}
How would you map the result to that query to your above Kotlin class?Justin
03/11/2022, 6:14 PMuser
object (doesn't matter what is on screen at that moment).
(fwiw the answer is different in terms of how the application publishes changes to the user
)Dariusz Kuc
03/11/2022, 6:18 PMDariusz Kuc
03/11/2022, 6:19 PMJustin
03/11/2022, 6:19 PMDariusz Kuc
03/11/2022, 6:19 PMapollo-android
or graphql-kotlin
to do itmbonnin
03/11/2022, 6:19 PMDariusz Kuc
03/11/2022, 6:20 PMmbonnin
03/11/2022, 6:20 PMJustin
03/11/2022, 6:24 PMmbonnin
03/11/2022, 6:26 PMRepository
or you will waste network bandwith and backend CPU time.mbonnin
03/11/2022, 6:27 PMJoe
03/11/2022, 8:00 PM