smallrye-graphql icon indicating copy to clipboard operation
smallrye-graphql copied to clipboard

#521: add federation to core:

Open t1 opened this issue 3 years ago • 1 comments

  • 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 and Bootstrap#fetchEntityType
  • [ ] add tests
  • [ ] properly resolve the class name
  • [ ] update README.

t1 avatar Oct 26 '21 07:10 t1

@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.

johgoe avatar Oct 29 '21 07:10 johgoe

@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?

t1 avatar Sep 02 '22 07:09 t1

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

t1 avatar Sep 02 '22 10:09 t1

Thanks @t1. I'll have a look a.s.a.p

phillip-kruger avatar Sep 03 '22 04:09 phillip-kruger

Is the documentation sufficient?

t1 avatar Sep 04 '22 17:09 t1

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.

robp94 avatar Sep 05 '22 08:09 robp94

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.

t1 avatar Sep 05 '22 16:09 t1

I think this is complete now and could be merged.

t1 avatar Sep 05 '22 16:09 t1

Hi @t1 - Thanks for this. I'll have a look as soon as I have a gap

phillip-kruger avatar Sep 06 '22 01:09 phillip-kruger

@jmartisk: it looks like @phillip-kruger is extremely busy with other things right now. maybe you can give some feedback?

t1 avatar Sep 15 '22 16:09 t1

I'll look at this soon. This will need a thorough review and we need to see if this will work in Quarkus

phillip-kruger avatar Sep 15 '22 22:09 phillip-kruger

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

jmartisk avatar Sep 16 '22 07:09 jmartisk

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.

t1 avatar Sep 16 '22 08:09 t1

hmmm... the build had a timeout when downloading some dependency. How can I restart the build? This used to be easy!

t1 avatar Sep 22 '22 15:09 t1

I'd suggest rebasing, as there is a conflict anyway ;) and pushing again

jmartisk avatar Sep 23 '22 06:09 jmartisk

@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

phillip-kruger avatar Sep 29 '22 22:09 phillip-kruger

@t1 Thanks for this massive contribution !

phillip-kruger avatar Sep 29 '22 22:09 phillip-kruger

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.

jmartisk avatar Sep 30 '22 06:09 jmartisk