diff --git a/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/java/file/SchemaBuilder.kt b/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/java/file/SchemaBuilder.kt index 62051b62e4c..980dcd31cc6 100644 --- a/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/java/file/SchemaBuilder.kt +++ b/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/java/file/SchemaBuilder.kt @@ -40,7 +40,7 @@ class SchemaBuilder( private fun typesFieldSpec(): FieldSpec { val allTypenames = interfaces.map { it.name } + objects.map { it.name } + unions.map { it.name } - val initilizer = allTypenames.map { + val initilizer = allTypenames.sortedBy { it }.map { CodeBlock.of("$T.type", context.resolver.resolveSchemaType(it)) }.toListInitializerCodeblock(withNewLines = true)