You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the GraphQL schema was build and not yet used in the GraphQL-server then needs an hook to modify/transform the GraphQL schema. The new schema should be used after the calling of the hook.
TypeResolver and Datafetcher are mandatory in federated GraphQL schemas. They can be add by the transformation process from single to federational schema.
This tools for transformation and usage gets by the following library:
com.apollographql.federation
federation-graphql-java-support
0.4.0
This snippet transformed the given single GraphQL schema to a federational GraphQL schema:
When the GraphQL schema was build and not yet used in the GraphQL-server then needs an hook to modify/transform the GraphQL schema. The new schema should be used after the calling of the hook.
TypeResolver and Datafetcher are mandatory in federated GraphQL schemas. They can be add by the transformation process from single to federational schema.
This tools for transformation and usage gets by the following library:
com.apollographql.federation
federation-graphql-java-support
0.4.0
This snippet transformed the given single GraphQL schema to a federational GraphQL schema:
import com.apollographql.federation.graphqljava.Federation;
import com.apollographql.federation.graphqljava.SchemaTransformer;
import graphql.schema.GraphQLSchema;
public class SchemaService {
GraphQLSchema transformToFederationalSchema(GraphQLSchema originalSchema) {
SchemaTransformer schemaTransformer = Federation.transform(originalSchema);
schemaTransformer.resolveEntityType(() ->{
.......;
});
schemaTransformer.fetchEntities(()->{
......
});
GraphQLSchema federationalSchema = schemaTransformer.build();
return federationalSchema;
}
}
Some more informations here (with spring):
https://github.com/apollographql/federation-jvm
https://github.com/rkudryashov/graphql-java-federation
The text was updated successfully, but these errors were encountered: