New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make Strapi GraphQL an implementing service for Federation #6146
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6146 +/- ##
==========================================
- Coverage 19.99% 19.98% -0.01%
==========================================
Files 858 858
Lines 12095 12094 -1
Branches 1965 1965
==========================================
- Hits 2418 2417 -1
Misses 8092 8092
Partials 1585 1585
Continue to review full report at Codecov.
|
Signed-off-by: Shahein Moussavi <shaheinm@gmail.com>
Signed-off-by: Shahein Moussavi <shaheinm@gmail.com>
Signed-off-by: Shahein Moussavi <shaheinm@gmail.com>
Signed-off-by: Shahein Moussavi <shaheinm@gmail.com>
Signed-off-by: Shahein Moussavi <shaheinm@gmail.com>
…e more descriptive Signed-off-by: Shahein Moussavi <shaheinm@gmail.com>
Any updates on this @alexandrebodin ? |
Hey @shaheinm can you give more context / example as to what you can do with this added ? |
When it will be in Release? |
@alexandrebodin One example is simply running Strapi as a microservice with Apollo Federation. My team is planning to customize the Strapi GraphQL schema to allow it to be extended in a versioning and indexing service, which will act as a sort of single source of truth, while Strapi provides the data on the client. We're also handling file uploads outside of Strapi, and simply plugging links into the content, and wanted that service at the same url for the client side application to access. |
👀 Would love to see this. We're also running a microservice environment with Federation and having our blog content alongside other service's data would be sweet. Please let me know if we can assist with getting this merged in any way. |
Right now the PR has conflicts. I would like to see if we can avoid having the dependency installed for everyone though 🤔 using some customization to add it programmaticaly maybe |
We also would like to use Federation instead of creating a Strapi connector in our middleware. Would be really nice to have this PR merged ASAP. |
I can try to resolve the conflicts in yarn.lock but I don't believe there is any way to avoid adding the dependency in package.json. Moreover, the |
@lauriejim Can you review the doc section ? |
We would also like to use the federation feature since it will allow us to "glue" multiple GraphQL servers (strapi, service 1, service 2, etc...) together which would be really handy. 💯 Let me know if anyone needs help to release this feature |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM ! In the future we will certainly make this modularized to avoid installing every possible extension of apollo :)
* Add Strapi GraphQL to Apollo Federation as implementation Signed-off-by: Shahein Moussavi <shaheinm@gmail.com> * updated graphql plugin documentation for federation Signed-off-by: Shahein Moussavi <shaheinm@gmail.com> * Creating separate package while waiting for Strapi PR acceptance Signed-off-by: Shahein Moussavi <shaheinm@gmail.com> * v3.1.0-beta.0 Signed-off-by: Shahein Moussavi <shaheinm@gmail.com> * Accidentally pushed bad changes Signed-off-by: Shahein Moussavi <shaheinm@gmail.com> * used lodash for config variable for consistency, updated comment to be more descriptive Signed-off-by: Shahein Moussavi <shaheinm@gmail.com> Signed-off-by: Gil Fernandes <gil.fernandes@onepointltd.com>
Hi, I saw this was merged... but can't seem to see these changes in the code / docs (3.5.0) did this get removed? |
in-fact - i have seen the changes to the config locations... However when I run an apollo federation gateway I see the following:
|
@benoj It wasn't removed, but someone changed flag name from |
Nice catch I'm going to make a fix for this but you can use isFederated as a workaround for now. |
This pull request has been mentioned on Strapi Community Forum. There might be relevant details there: https://forum.strapi.io/t/is-it-possible-to-use-the-apollo-federation-specification/4334/3 |
@alexandrebodin, @shaheinm, the documentation around this for Strapi v4 seems to be lacking. Are there any resources for how to set this up? Specifically, relating to the |
This doesn't seem to be implemented in v4 unfortunately - would be great if it was 👀 |
Is this feature planned to be implemented in v4 ? |
Description of what you did:
Fix #4870
Added
federation
flag to GraphQL plugin config.Upload
scalar created by Strapi is not removed, as a Federated schema requires the use of@apollo/federation
package'sbuildFederatedSchema()
function, and that function usesmakeExecutableSchema
under the hood, requiring the inclusion of the scalarUpload
.NOTE: I purposely did not include anything related to the
@key
directive, which sets up the ability to extend types in other services included in Federation. You can use Strapi's custom GraphQL schema definition to do this, though.No tests were added or changed, but all are passing. Documentation was updated accordingly.