Hi, I'm pretty new to Kotlin. I'm following the `e...
# graphql-kotlin
p
Hi, I'm pretty new to Kotlin. I'm following the
examples/server/ktor/
repo and trying to generate a schema for my ktor server, but I'm getting this error:
Copy code
Caused by: com.expediagroup.graphql.generator.exceptions.InvalidPackagesException: The configured packages do not contain any valid classes: "[com.ppseafield, com.ppseafield.graphql]"
The
com.ppseafield.graphql
package contains a
class UserService : Query {}
. How can I make sure the
SchemaGenerator
sees my classes?
Using
graphql-kotlin-server
and
graphql-kotlin-schema-generator
v6.2.2
d
does
UserService
contains any functions?
p
Copy code
class UserQuery : Query {
    @GraphQLDescription("Check if a username already exists.")
    fun usernameExists(username: String): Boolean {
        return false
    }
    fun motd(): String {
        return "howdy, folks!"
    }
}
Sorry, I renamed it to UserQuery
I've just tried using the gradle plugin to generate the schema, but it just exits with no output. (There's a brief flash of text.)
d
hard to say what is happening
do you have a github repo?
p
Setting one up now, one moment
Here's the full output when trying to run it: https://gist.github.com/ppseafield/1a953fe93c086b8d1be431cd9b9af537
Hmm, it does look like
build/schema.graphql
is being built correctly with the gradle plugin
@Dariusz Kuc I eventually fixed it, although I wouldn't say I figured it out completely: Ktor's development mode watches classes for changes/recompiling. When I removed
development = true
from my configuration, I was able to run the server.
Thanks for your help 🙂
d
👍
yeah unsure why dev = true would make classes unavailable on the classpath
p
I'm not sure either. I'm very new to the java ecosystem. 🙂
d
you can check with #ktor folks maybe they can shed some light on it, not familiar with it so cannot say
103 Views