One of the main design principles we follow when building a GraphQL API is to maximize backwards compatibility. To avoid unexpected breaking changes, we have integrated GraphQL Inspector into our build pipeline.
After upgrading to HotChocolate 13, the schema comparison started to fail:
It complains that the defer and stream directive are no longer there. And indeed if we open up the schema before the upgrade:
And compare it to the schema after the upgrade:
We can see that the 2 directives are no longer there.
We can easily fix this by re-enabling both directives in our GraphQL configuration code:
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.AddGraphQLServer() | |
.ModifyOptions(o => | |
{ | |
o.EnableDefer = true; | |
o.EnableStream = true; | |
}); |
Remark: If you are paying attention, you can see that there was another breaking change regarding the cost directive. More about that in the following post.
More information
GraphQL Inspector (bartwullems.blogspot.com)
Migrate Hot Chocolate from 12 to 13 - Hot Chocolate - ChilliCream GraphQL Platform