File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ class ConfigurationScope(
5555 */
5656class Configuration (
5757 val websocket : Boolean ,
58+ val builtins : Boolean ,
5859 val connectionInitWaitTimeout : Duration ? ,
5960 val engine : GraphktEngineFactory ,
6061 val schemaBlock : GraphQLSchemaBuilderBlock ,
@@ -80,6 +81,15 @@ class ConfigurationBuilder : WithEngine, WithDeferredBuilder {
8081 */
8182 var websocket: Boolean = true
8283
84+ /* *
85+ * True, to add all the non-standard builtin scalars as additional types.
86+ *
87+ * Standard built-in scalars are added anyway.
88+ *
89+ * @since 2.0.0
90+ */
91+ var builtins: Boolean = true
92+
8393 /* *
8494 * Websocket connection initialization timeout.
8595 *
@@ -135,6 +145,7 @@ class ConfigurationBuilder : WithEngine, WithDeferredBuilder {
135145 deferred.forEach { it() }
136146 deferred.clear()
137147 return Configuration (
148+ builtins = builtins,
138149 websocket = websocket,
139150 connectionInitWaitTimeout = connectionInitWaitTimeout,
140151 engine = engine
Original file line number Diff line number Diff line change @@ -23,9 +23,7 @@ import kotlinx.coroutines.flow.map
2323import org.cufy.graphkt.InternalGraphktApi
2424import org.cufy.graphkt.ktor.internal.graphqlHttp
2525import org.cufy.graphkt.ktor.internal.graphqlWebsocket
26- import org.cufy.graphkt.schema.GraphQLRequest
27- import org.cufy.graphkt.schema.GraphQLResponse
28- import org.cufy.graphkt.schema.GraphQLSchema
26+ import org.cufy.graphkt.schema.*
2927
3028/* *
3129 * Handle graphql requests to the given [path].
@@ -62,6 +60,13 @@ fun Route.graphql(
6260 /* prepare base arguments */
6361
6462 val schema = GraphQLSchema {
63+ if (configuration.builtins) {
64+ additionalType(GraphQLLongType )
65+ additionalType(GraphQLDecimalType )
66+ additionalType(GraphQLIntegerType )
67+ additionalType(GraphQLVoidType )
68+ }
69+
6570 configuration.schemaBlock(this )
6671 }
6772
You can’t perform that action at this time.
0 commit comments