Skip to content
This repository has been archived by the owner on May 16, 2019. It is now read-only.

Extension Properties

Paweł Gutkowski edited this page Jul 28, 2017 · 2 revisions

Extension properties allow schema creator to easily attach additional field to any type. It is separately evaluated after main entity is resolved.

property { }

property method accepts resolver and can be subject of deprecation.

Example

data class Person(val name: String, val age: Int)

KGraphQL.schema {
    type<Person>{
        property<Boolean>("isChild"){
            resolver { person -> (person.age <= 18) }
        }
    }
}