We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Having an error com.apurebase.kgraphql.schema.SchemaException: An Object type must define one or more fields. Found none on type Id
com.apurebase.kgraphql.schema.SchemaException: An Object type must define one or more fields. Found none on type Id
@Serializable data class User( @SerialName("_id") @Contextual val id: Id<User> = newId(), val username: String, val password: String, )
type<Id<User>>() type<User>()
The text was updated successfully, but these errors were encountered:
Should the ObjectId of a model not rather be defined in graphql using a scalar and mapping it to a string?
Sorry, something went wrong.
Solved with
schema { configure { genericTypeResolver = object: DefaultGenericTypeResolver() { override fun resolveMonad(type: KType): KType = when { type.jvmErasure.isSubclassOf(Id::class) -> type.arguments[0].type!!.withNullability(type.isMarkedNullable) else -> super.resolveMonad(type) } override fun unbox(obj: Any): Any? = when(obj) { is Id<*> -> obj.toString() else -> super.unbox(obj) } } } }
No branches or pull requests
Having an error
com.apurebase.kgraphql.schema.SchemaException: An Object type must define one or more fields. Found none on type Id
Mongo User Document Model
Schema Type
The text was updated successfully, but these errors were encountered: