hotchoc fusion commands - exporting schema, packing and composing your supergraph

 To get started please run 

dotnet new tool-manifest

Then install hotchoc fusion command 


dotnet tool install HotChocolate.Fusion.CommandLine

Then go to your subgraph project such as account or product or review. Ensure that you have "RunWithGraphQLCommands" configured as shown below:-


using System.Numerics;

var builder = WebApplication.CreateBuilder(args);

builder.Services
    .AddSingleton<UserRepository>();

builder.Services
    .AddGraphQLServer()
    .AddTypes()
    .AddGlobalObjectIdentification()
    .RegisterService<UserRepository>();

var app = builder.Build();
app.MapGraphQL();
app.RunWithGraphQLCommands(args);


Then run the following command in your subgraph project to generate the graphql schema.

dotnet run -- schema export --output schema.graphql

Next run 

dotnet fusion subgraph pack

This will create a package with extension ccspkg, that contains schema, extensions and configuration of the subgraph.

Then you can compose your supergraph by running dotnet fusion compose. You need to specify the path and source of your subgraphs as shown here.

dotnet fusion compose -p .\gateway\gateway -s .\accounts\


















Comments

Popular posts from this blog

The specified initialization vector (IV) does not match the block size for this algorithm