When using (HotChocolate) Schema stitching by default all root query types are merged and available to use in your stitched schema:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ConfigureServices(IServiceCollection services) | |
{ | |
// enable InMemory messaging services for subscription support. | |
services.AddInMemorySubscriptionProvider(); | |
//// this enables you to use DataLoader in your resolvers. | |
services.AddDataLoaderRegistry(); | |
services.AddStitchedSchema(builder => builder | |
.AddSchemaFromHttp("countries") | |
.AddSchemaFromHttp("languages")); | |
services.AddHttpClient("countries", (sp, client) => | |
{ | |
client.BaseAddress = new Uri("https://127.0.0.1:9003/countries/graphql"); | |
}); | |
services.AddHttpClient("languages", (sp, client) => | |
{ | |
client.BaseAddress = new Uri("http://127.0.0.1:9004/languages/graphql"); | |
}); | |
services.AddGraphQLSubscriptions(); | |
} |
This is great as default behavior but not if you want to build up the stitched schema in a different way. To start from a clean slate you can call IgnoreRootTypes():
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services.AddStitchedSchema(builder => builder | |
.AddSchemaFromHttp("countries").IgnoreRootTypes() | |
.AddSchemaFromHttp("languages").IgnoreRootTypes() |