Skip to content

Instantly share code, notes, and snippets.

@jeggy
Created June 17, 2019 10:09
Show Gist options
  • Save jeggy/0b514439a9b2588a28b62433c2da4713 to your computer and use it in GitHub Desktop.
Save jeggy/0b514439a9b2588a28b62433c2da4713 to your computer and use it in GitHub Desktop.
KGraphQL#29
class SchemaException29 {
data class UUID(val id: Int?)
data class TimeEntry(val id: UUID, val name: String)
val schema = defaultSchema {
query("get") {
resolver { ->
TimeEntry(UUID(25), "Name")
}
}
type<TimeEntry> {
property<String?>("id") {
resolver { entry: TimeEntry ->
entry.id.id.toString()
}
}
}
}
@Test
fun `override property with different type`() {
val res = schema.execute("{ get { id, name } }")
println(res) // Prints: {"data":{"get":{"id":"25","name":"Name"}}}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment