I’m investigating porting our existing Kotlin grap...
# graphql-kotlin
d
I’m investigating porting our existing Kotlin graphql server to graphql-kotlin. One thing I’m not quite clear on from docs — I see that you specify packages to scan for classes, but how does that relate to providing root types? eg, if a type in one of the packages references (arguments, return type, etc) a type from a faraway package, will that type be processed into the schema too, or not? and do all types in the specified packages get treated as graphql types by default, or only those reachable from the root types?
s
Hi David, The
packages
config must include every package that has your schema types. If we are building your schema and we come across a type that is used as an argument or return type, and it is not in the packages, we will throw an error. This is because we need to use reflection to scan the class info when building the schema and the
packages
config limits us from having to scan your entire app and classpath for all possible classes.
That doesn’t mean though that every class in the
packages
will be included in the schema, it is only the types that are used and defined through the queries, mutations, and subscriptions