-
Notifications
You must be signed in to change notification settings - Fork 368
Open
Labels
module: generatorIssue affects the schema generator and federation codeIssue affects the schema generator and federation codetype: enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem? Please describe.
Consider the following query:
fun echo(json: JsonNode?): JsonNode? = jsonThe type JsonNode is an abstract class and resolved to a custom scalar as explained in the documentation:
fun schemaGeneratorHooks() = object : SchemaGeneratorHooks {
override fun willGenerateGraphQLType(type: KType): GraphQLType? {
return when (type.classifier) {
JsonNode::class -> jsonScalar
else -> null
}
}
}However, this does not work. JsonNode is an abstract class, and generateArgument.kt disallows those before resolving the type using the schema generator hooks.
Describe the solution you'd like
Move the check, that no interface / union would be generated from generateArgument.kt to objectFromReflection (of course only check if it is an input type).
Describe alternatives you've considered
Currently, I use a workaround where I use Any as Kotlin type and specify the scalar using @GraphQLType, however, this results in unnecessary casts.
Metadata
Metadata
Assignees
Labels
module: generatorIssue affects the schema generator and federation codeIssue affects the schema generator and federation codetype: enhancementNew feature or requestNew feature or request