smallrye-graphql
smallrye-graphql copied to clipboard
#521: add federation to core:
- move federation api into smallrye-graphql-api
- add config to enable federation
- add dependency on com.apollographql.federation:federation-graphql-java-support
- transform federation schema
- remove old federation module
- [x] implement
Bootstrap#fetchEntities
andBootstrap#fetchEntityType
- [ ] add tests
- [ ] properly resolve the class name
- [ ] update README.
@t1 In our project we got a working quarkus server with federation, with some technical tricks like working with a 2nd jandex index and manipulation of the schema in the federation gateway itself.
Because of that we find some cases that hat not been working before in Smallrye Federation. I pushed this changes to
https://github.com/smallrye/smallrye-graphql/pull/1135
Maybe it can support you for rewriting.
@phillip-kruger & @johgoe : I think the core federation functionality should be working. I have some trouble to get my tests with the ApolloGateway
to work properly. It seem that it doesn't recognise the @key(fields : ["id"])
directive, but AFAIU this should be legal. IIRC I had to work around this in the former, hand-made solution. Could you help me double-check?
It works after updating Apollo to the latest version!!! So it was a bug.
I shared my demo project: https://github.com/t1/smallrye-graphql-federation-demo
I'll continue writing tests now.
Comments welcome!!!!!!!1111
Thanks @t1. I'll have a look a.s.a.p
Is the documentation sufficient?
Looks nice. Does it support mutiny return types? Would this already work with quarkus? Then we could test it with our services and see if we find anything.
Does it support mutiny return types?
It probably should, but I haven't tried.
Would this already work with quarkus?
The quarkus tests fail with compile errors that I don't recognise immediately.
I think this is complete now and could be merged.
Hi @t1 - Thanks for this. I'll have a look as soon as I have a gap
@jmartisk: it looks like @phillip-kruger is extremely busy with other things right now. maybe you can give some feedback?
I'll look at this soon. This will need a thorough review and we need to see if this will work in Quarkus
This could also use writing some Quarkus-side integration test coverage as part of doing the review (well, if possible - because running a real integration test seems to require a gateway and at least two Quarkus instances, which makes it very difficult) If you prefer I can get to it, but I'm quite unfamiliar with Federation so it will take me quite some time
You're right, writing a real integration test would mean running a node app. But there's already a simplified integration test in the tck package, which only checks the result of a single federated request. This, and the Federation specific directives, should be good enough for now. And maybe we will get back to Feder soon, so we could add a full integration test and still stay 100% Java.
hmmm... the build had a timeout when downloading some dependency. How can I restart the build? This used to be easy!
I'd suggest rebasing, as there is a conflict anyway ;) and pushing again
@jmartisk - I am merging here. Can you help with creating a new 1.9.x branch and backport (non-Jakarata) to there ? Then I cal look at the jandex in that branch and once we are happy we can get this into Quarkus. Le me know
@t1 Thanks for this massive contribution !
I'll create a 1.9.x branch with this that will target Quarkus 2.15, which is due some time in December or January, so we will have enough time to polish it. At minimum, I believe we should make the new dependency (federation-graphql-java-support
) optional so it doesn't have to be included with every application even if it doesn't use Federation.