1717package org .springframework .graphql .data .federation ;
1818
1919import java .lang .reflect .Method ;
20+ import java .util .ArrayList ;
2021import java .util .LinkedHashMap ;
2122import java .util .List ;
2223import java .util .Map ;
6768 * @author Rossen Stoyanchev
6869 * @since 1.3.0
6970 * @see Federation#transform(TypeDefinitionRegistry, RuntimeWiring)
70- *
7171 */
7272public final class FederationSchemaFactory
7373 extends AnnotatedControllerDetectionSupport <FederationSchemaFactory .EntityMappingInfo > {
@@ -80,7 +80,7 @@ public final class FederationSchemaFactory
8080
8181 /**
8282 * Configure a resolver that helps to map Java to entity schema type names.
83- * <p>By default this is {@link ClassNameTypeResolver}.
83+ * <p>By default, this is {@link ClassNameTypeResolver}.
8484 * @param typeResolver the custom type resolver to use
8585 * @see SchemaTransformer#resolveEntityType(TypeResolver)
8686 */
@@ -186,13 +186,19 @@ public SchemaTransformer createSchemaTransformer(TypeDefinitionRegistry registry
186186 }
187187
188188 private void checkEntityMappings (TypeDefinitionRegistry registry ) {
189+ List <String > unmappedEntities = new ArrayList <>();
189190 for (TypeDefinition <?> type : registry .types ().values ()) {
190191 type .getDirectives ().forEach ((directive ) -> {
191192 boolean isEntityType = directive .getName ().equalsIgnoreCase ("key" );
192- Assert .state (!isEntityType || this .handlerMethods .containsKey (type .getName ()),
193- "No EntityMapping method for federated type: '" + type .getName () + "'" );
193+ if (isEntityType && !this .handlerMethods .containsKey (type .getName ())) {
194+ unmappedEntities .add (type .getName ());
195+ }
194196 });
195197 }
198+ if (!unmappedEntities .isEmpty ()) {
199+ throw new IllegalStateException ("Unmapped entity types: " +
200+ unmappedEntities .stream ().collect (Collectors .joining ("', '" , "'" , "'" )));
201+ }
196202 }
197203
198204
0 commit comments