Closed 110y closed 7 months ago
The update introduces a new federation
field in the configuration, specifically for Apollo Federation with a version: 2
directive. It enhances the GraphQL schema to support federation by adding necessary federation directives, conditional on the federation version being set. This allows for more flexible and scalable GraphQL architecture by enabling services to be composed into a single federated schema.
Files | Change Summary |
---|---|
README.md config/config.go |
Added the federation field with the version: 2 directive under the models section in the configuration file, affecting the schema definition for Apollo Federation and included a Federation field of type config.PackageConfig to the Config struct. |
generator/generator.go |
Modified to include the import of the federation package from github.com/99designs/gqlgen/plugin/federation and added a conditional block to inject federation directives into the GraphQL schema if the federation version is not 0. |
🐇✨
In the land of code and schema, where the data rivers flow,
A rabbit hopped, with updates in tow,
"Federation!" it cheered, with a leap so high,
"For a united graph, under one sky."
🌌🚀
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
@Yamashou
Ah sorry, fixed it! I appreciate it if you could take another look, thanks 🙏
What
gqlgenc
recognize Apollo Federation related GraphQL directives.Why
Current
gqlgenc
raises anUndefined directive
error when a target GraphQL schema includes Apollo Federation related directives. This is just becausegqlgenc
does not recognize unknown directives not declared in a schema. Regarding the originalgqlgen
, it has special treatments for Apollo Federation, so we don't have to explicitly declare Apollo Federation related directives in our schema. Given that, I think it is better to makegqlgenc
recognize Apollo Federation related directives like the originalgqlgen
.Summary by CodeRabbit