Skip to content

Commit

Permalink
update spring config
Browse files Browse the repository at this point in the history
  • Loading branch information
dariuszkuc committed Jun 5, 2024
1 parent a9a0e30 commit 828564b
Showing 1 changed file with 9 additions and 21 deletions.
30 changes: 9 additions & 21 deletions spring-subscription-callback/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,28 +99,16 @@ public class GraphQLConfiguration {
return new CallbackWebGraphQLInterceptor(callbackHandler);
}

// regular federation transform
// regular federation transforms
// see https://docs.spring.io/spring-graphql/reference/federation.html
@Bean
public GraphQlSourceBuilderCustomizer federationTransform() {
DataFetcher<?> entityDataFetcher =
env -> {
List<Map<String, Object>> representations = env.getArgument(_Entity.argumentName);
return representations.stream()
.map(
representation -> {
// TODO implement entity data fetcher logic here
return null;
})
.collect(Collectors.toList());
};

return builder ->
builder.schemaFactory(
(registry, wiring) ->
Federation.transform(registry, wiring)
.fetchEntities(entityDataFetcher)
.resolveEntityType(new ClassNameTypeResolver())
.build());
public GraphQlSourceBuilderCustomizer customizer(FederationSchemaFactory factory) {
return builder -> builder.schemaFactory(factory::createGraphQLSchema);
}

@Bean
FederationSchemaFactory federationSchemaFactory() {
return new FederationSchemaFactory();
}
}
```
Expand Down

0 comments on commit 828564b

Please sign in to comment.