Skip to content

Commit

Permalink
test(example): Updated the example to showcase recursion solutions
Browse files Browse the repository at this point in the history
  • Loading branch information
LSafer committed May 22, 2023
1 parent 6693078 commit 1febf33
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions example/src/main/kotlin/example.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ val CustomScalarType = GraphQLScalarType<CustomScalar> {
}
}

val CustomObjectType: GraphQLObjectType<CustomObject> = GraphQLObjectType {
object CustomObjectType : GraphQLObjectClass<CustomObject>({
name("Custom")
description { "An example of a custom object type." }
field(CustomObject::name) {
Expand All @@ -45,7 +45,28 @@ val CustomObjectType: GraphQLObjectType<CustomObject> = GraphQLObjectType {
type { GraphQLStringType }
description { "The value of the object." }
}
}
field("this") {
type { CustomObjectType }
description { "This" }
get { instance }
}
field("copycatOfThis") {
type { CustomObjectTypeCopyCat }
description { "This but as the copycat version." }
get { instance }
}
})

object CustomObjectTypeCopyCat : GraphQLObjectClass<CustomObject>({
name("CustomCopyCat")
description { "An example of a custom object type copying another type." }

directives += CustomObjectType.directives
interfaces += CustomObjectType.interfaces
onGetBlocks += CustomObjectType.onGetBlocks
onGetBlockingBlocks += CustomObjectType.onGetBlockingBlocks
fields += CustomObjectType.fields
})

fun main() {
embeddedServer(
Expand Down

0 comments on commit 1febf33

Please sign in to comment.