diff --git a/data-index/data-index-graphql/src/main/java/org/kie/kogito/index/graphql/AbstractGraphQLSchemaManager.java b/data-index/data-index-graphql/src/main/java/org/kie/kogito/index/graphql/AbstractGraphQLSchemaManager.java index 2b86012b77..142f2c02a4 100644 --- a/data-index/data-index-graphql/src/main/java/org/kie/kogito/index/graphql/AbstractGraphQLSchemaManager.java +++ b/data-index/data-index-graphql/src/main/java/org/kie/kogito/index/graphql/AbstractGraphQLSchemaManager.java @@ -42,7 +42,10 @@ import org.kie.kogito.index.storage.DataIndexStorageService; import org.kie.kogito.persistence.api.StorageFetcher; import org.kie.kogito.persistence.api.query.Query; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import graphql.schema.DataFetcher; import graphql.schema.DataFetchingEnvironment; import graphql.schema.GraphQLInputObjectType; import graphql.schema.GraphQLNamedType; @@ -68,6 +71,8 @@ public abstract class AbstractGraphQLSchemaManager implements GraphQLSchemaManag private static final String UNABLE_TO_FIND_ERROR_MSG = "Unable to find the instance with %s %s"; + private static final Logger LOGGER = LoggerFactory.getLogger(AbstractGraphQLSchemaManager.class); + @Inject DataIndexStorageService cacheService; @@ -84,6 +89,7 @@ public abstract class AbstractGraphQLSchemaManager implements GraphQLSchemaManag @PostConstruct public void setup() { mutations = ServiceLoader.load(GraphQLMutationsProvider.class).stream().map(Provider::get).collect(Collectors.toList()); + schema = createSchema(); GraphQLQueryParserRegistry.get().registerParsers( (GraphQLInputObjectType) schema.getType("ProcessDefinitionArgument"), @@ -93,8 +99,10 @@ public void setup() { } protected final void loadAdditionalMutations(Builder builder) { - mutations.stream().map(m -> m.mutations(this)).flatMap(map -> map.entrySet().stream()) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (v1, v2) -> v2)).forEach(builder::dataFetcher); + Map>> mutationMap = mutations.stream().map(m -> m.mutations(this)).flatMap(map -> map.entrySet().stream()) + .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (v1, v2) -> v2)); + LOGGER.info("Custom mutations are {}", mutationMap); + mutationMap.forEach(builder::dataFetcher); } protected final void loadAdditionalMutations(TypeDefinitionRegistry typeRegistry) {