Skip to content
New issue

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

"Generic types are not supported by GraphQL" #154

Open
Digital-Nomad opened this issue Jul 7, 2021 · 2 comments
Open

"Generic types are not supported by GraphQL" #154

Digital-Nomad opened this issue Jul 7, 2021 · 2 comments

Comments

@Digital-Nomad
Copy link

I am running into this error in my project:

Exception in thread "main" com.apurebase.kgraphql.schema.SchemaException: Generic types are not supported by GraphQL, found kotlin.collections.Map<org.jetbrains.exposed.sql.Expression<*>, kotlin.Int>
	at com.apurebase.kgraphql.schema.structure.SchemaCompilation.handlePossiblyWrappedType(SchemaCompilation.kt:168)
	at com.apurebase.kgraphql.schema.structure.SchemaCompilation.handleKotlinProperty(SchemaCompilation.kt:372)

My project is located here. If you take a look at my ExposedFeed.kt, you can see I setup the Exposed DAO classes as they are shown in the Exposed examples but in your example code you use data class and you don't need to define the type it seems. Is this why I am running into this error?

@jeggy
Copy link
Member

jeggy commented Jul 7, 2021

I haven't tested KGraphQL integration with Exposed before. But I can see they don't work so well together 😮

The issue is that your ExposedFeed class is extending the IntEntity which is extending Entity<Int> and this class provided by exposed includes some public fields that KGraphQL is trying to make available on your GraphQL Type.

KGraphQL has an option to ignore fields on a specific type. To get this to work you would need to specify this on all of your exposed types

// 1kotlin classes need to be registered with "type" method
// to be included in created schema type system
// class Character is automatically included,
// as it is return type of both created queries
type<ExposedFeed> {
    ExposedFeed::id.ignore()
    ExposedFeed::klass.ignore()
    ExposedFeed::db.ignore()
    ExposedFeed::writeValues.ignore()
    ExposedFeed::_readValues.ignore()
    ExposedFeed::readValues.ignore()
}
type<ExposedEntry> {
    ExposedEntry::id.ignore()
    ExposedEntry::klass.ignore()
    ExposedEntry::db.ignore()
    ExposedEntry::writeValues.ignore()
    ExposedEntry::_readValues.ignore()
    ExposedEntry::readValues.ignore()
}

I have created a new issue to provide better error reporting on these types of errors #155

@Digital-Nomad
Copy link
Author

Digital-Nomad commented Jul 8, 2021

Ignoring those functions, I now get the following error:

Couldn't retrieve 'author' from class org.jetbrains.exposed.sql.IterableExKt$mapLazy$1@6a992897}",
With this query

query {
  RSSFeeds
  {
    author
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants