Federation conflicting types #1309
-
Hi all! I am currently working on a POC with Apollo Federation, with multiple (federated) kotlin graphql servers. In 1 service, at startup, I get the following stacktrace. Apparently you can't use an extended type in a "normal" type? Is that correct? Exception in thread "main" com.expediagroup.graphql.generator.exceptions.ConflictingTypesException: Conflicting class names in schema generation [class com.example.graphql.models.LogItem, class com.example.graphql.models.LogItem]
at com.expediagroup.graphql.generator.internal.state.TypesCache.get$graphql_kotlin_schema_generator(TypesCache.kt:57)
at com.expediagroup.graphql.generator.internal.state.TypesCache.get$graphql_kotlin_schema_generator(TypesCache.kt:45)
at com.expediagroup.graphql.generator.internal.types.GenerateGraphQLTypeKt.objectFromReflection(generateGraphQLType.kt:53)
at com.expediagroup.graphql.generator.internal.types.GenerateGraphQLTypeKt.generateGraphQLType(generateGraphQLType.kt:40)
at com.expediagroup.graphql.generator.internal.types.GenerateGraphQLTypeKt.generateGraphQLType$default(generateGraphQLType.kt:36)
at com.expediagroup.graphql.generator.SchemaGenerator.generateAdditionalTypes(SchemaGenerator.kt:123)
at com.expediagroup.graphql.generator.SchemaGenerator.generateSchema(SchemaGenerator.kt:83)
at com.expediagroup.graphql.generator.federation.FederatedSchemaGenerator.generateSchema(FederatedSchemaGenerator.kt:42)
at com.expediagroup.graphql.generator.SchemaGenerator.generateSchema$default(SchemaGenerator.kt:73)
at com.expediagroup.graphql.generator.federation.ToFederatedSchemaKt.toFederatedSchema(toFederatedSchema.kt:42)
at com.expediagroup.graphql.generator.federation.ToFederatedSchemaKt.toFederatedSchema$default(toFederatedSchema.kt:38) The models and query: @KeyDirective(fields = FieldSet("id"))
data class Log(
val id: Int,
val logItems: List<LogItem>
) @ExtendsDirective
@KeyDirective(fields = FieldSet("id"))
data class LogItem(
@ExternalDirective val id: Int,
val text: String
) class LogQueryService : Query {
fun getAll(): List<Log> {
return listOf(
Log(1, emptyList())
)
}
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
You don't need to use the extends if the type is all in the same service. Where is the definition of |
Beta Was this translation helpful? Give feedback.
-
Okay, update, so apparently I had a Ktor setting that breaks everything. When I got rid of |
Beta Was this translation helpful? Give feedback.
Okay, update, so apparently I had a Ktor setting that breaks everything. When I got rid of
io.ktor.development=true
, everything worked again. Probably something with the class caching.