Created
June 17, 2019 10:09
-
-
Save jeggy/0b514439a9b2588a28b62433c2da4713 to your computer and use it in GitHub Desktop.
KGraphQL#29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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