The graphql specification states that id scalar type should be supported by all graphql servers.
Therefore, I think that it is necessary to add the ID type to "BUILT_IN_TYPE" even in kgraphql.
At present, it can be realized in each project by the following method, but I think that it should be provided by default of kgraphql, but what about?
// define
class ID(var value:String) {
override fun toString():String {
return value
}
}
// make scalar type
fun SchemaBuilder.schemaScalar() {
stringScalar<ID> {
description = "ID"
deserialize = { it:String -> ID(it) }
serialize = { it: ID -> it.toString() }
}
}
// option. convenient to have
fun String.toID():ID {
return ID(this)
}
// make data class
data class User(var id:ID, var name:String)
val user = User("user01".toID(), "Hathaway Noa")
The graphql specification states that id scalar type should be supported by all graphql servers. Therefore, I think that it is necessary to add the ID type to "BUILT_IN_TYPE" even in kgraphql.
[graphql specification] http://spec.graphql.org/October2021/
At present, it can be realized in each project by the following method, but I think that it should be provided by default of kgraphql, but what about?