Skip to content

Commit 1febf33

Browse files
committed
test(example): Updated the example to showcase recursion solutions
1 parent 6693078 commit 1febf33

1 file changed

Lines changed: 23 additions & 2 deletions

File tree

example/src/main/kotlin/example.kt

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ val CustomScalarType = GraphQLScalarType<CustomScalar> {
3434
}
3535
}
3636

37-
val CustomObjectType: GraphQLObjectType<CustomObject> = GraphQLObjectType {
37+
object CustomObjectType : GraphQLObjectClass<CustomObject>({
3838
name("Custom")
3939
description { "An example of a custom object type." }
4040
field(CustomObject::name) {
@@ -45,7 +45,28 @@ val CustomObjectType: GraphQLObjectType<CustomObject> = GraphQLObjectType {
4545
type { GraphQLStringType }
4646
description { "The value of the object." }
4747
}
48-
}
48+
field("this") {
49+
type { CustomObjectType }
50+
description { "This" }
51+
get { instance }
52+
}
53+
field("copycatOfThis") {
54+
type { CustomObjectTypeCopyCat }
55+
description { "This but as the copycat version." }
56+
get { instance }
57+
}
58+
})
59+
60+
object CustomObjectTypeCopyCat : GraphQLObjectClass<CustomObject>({
61+
name("CustomCopyCat")
62+
description { "An example of a custom object type copying another type." }
63+
64+
directives += CustomObjectType.directives
65+
interfaces += CustomObjectType.interfaces
66+
onGetBlocks += CustomObjectType.onGetBlocks
67+
onGetBlockingBlocks += CustomObjectType.onGetBlockingBlocks
68+
fields += CustomObjectType.fields
69+
})
4970

5071
fun main() {
5172
embeddedServer(

0 commit comments

Comments
 (0)