Strawberry Shake GraphQL Client–Update client after changing schema

 

I blogged about the Strawberry Shake Graphql Client before and today it is my go to tool in .NET when consuming GraphQL API’s. But I always forget the steps to take when the consumed GraphQL schema has changed. So this is a reminder for myself.

Add the CLI tools

It can be that the CLI tools are not yet installed. In that case we should run dotnet tool restore first. This will read out the tool manifest and install any missing tools:

>dotnet tool restore

Tool ‘strawberryshake.tools’ (version ‘12.0.1’) was restored. Available commands: dotnet-graphql

Restore was successful.

Now we can invoke the graphql update command. This will read out the .graphqlrc.json configuration file and updates the local schema.graphqlfile.

>dotnet graphql update

 

Download schema started.

 

Download schema completed in 1328 ms

If we now build our application, the Strawberry Shake Client code generation will be triggered and new / updated C# code will be generated.

 

Read more here: Source link