Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Query for federation-jvm #395

Open
amarflybot18 opened this issue Apr 16, 2020 · 17 comments
Open

Query for federation-jvm #395

amarflybot18 opened this issue Apr 16, 2020 · 17 comments

Comments

@amarflybot18
Copy link

Hi,

Do you have support for apollographql federation-jvm in graphql-spring-boot?

If you already have some schema files defined with custom directives, this project fails to generate schema. Especially for type Query{}.

@oliemansm
Copy link
Member

Federation isn't supported yet.

@amarflybot18
Copy link
Author

Could you please guide me in getting a bean for runtimeWiring out ?

@oliemansm
Copy link
Member

I don't understand the question.

@amarflybot18
Copy link
Author

amarflybot18 commented Apr 16, 2020

If you look at the example mentioned in https://github.com/apollographql/federation-jvm/blob/master/spring-example/src/main/java/com/apollographql/federation/springexample/InventorySchemaProvider.java. For that example to work with Custom Scalars, we would need additional Runtime argument.

public static SchemaTransformer transform(final Reader sdl, final RuntimeWiring runtimeWiring) {
        return transform(new SchemaParser().parse(sdl), runtimeWiring);
    }

@amarflybot18
Copy link
Author

This would have backward compatibility with all the datafetchers precreated.

@oliemansm
Copy link
Member

My first comment was that we don't support federation yet, and we also don't expose RuntimeWiring in any way at the moment. We do intend to add support for Federation at some point and any contributions to add support for Federation are appreciated, but until then there's nothing much we can do for you.

@amarflybot18
Copy link
Author

Thanks.

@setchy
Copy link
Member

setchy commented Dec 20, 2020

@amarflybot18 @oliemansm - I'd be interested to help work on this item.

I do have several services using federation-jvm in production and had to do some pretty hacky workarounds to get it working in the interim.

@oliemansm
Copy link
Member

@setchy Thanks for reaching out and the offer to help out! If it helps I can invite you to our Slack to discuss details and/or align with rest of the team where necessary?

@setchy
Copy link
Member

setchy commented Dec 20, 2020

That would be perfect @oliemansm

@setchy
Copy link
Member

setchy commented Apr 15, 2021

some updates happening on the federation-jvm spring-boot kickstart example

@setchy
Copy link
Member

setchy commented May 6, 2021

Apollo updated their graphql-java-tools example within https://github.com/apollographql/federation-jvm/tree/master/spring-example a few weeks ago.

I also have an example of a federation + 2 graphql-spring-boot services over at https://github.com/setchy/spring-boot-federation-example

Hopefully these are good resources to help you our @amarflybot18

While on the topic, I have raised a separate enhancement in Apollo federation-jvm to simplify the amount of boilerplate code needed - apollographql/federation-jvm#108

@stengvac
Copy link

stengvac commented Nov 12, 2021

Hello,

we use kickstart + spring boot on our backend with micro services. And we needed to add support for Federation. So with examples provide by @setchy I have created lib, which we currently use until kickstart support federation directly. I have put code to repo as possible reference. README.md and tests show how it works so maybe it may be used for future kickstart implemetation or help other guys struggling with tfederation and kickstart combo.

Principle is pretty same as use kickstart lib itself - implement interface for Federation type FederationReferenceResolver<Account>.

@Component
class AccountResolver : GraphQLResolver<Account>, FederationReferenceResolver<Account> {
    fun balance(context: Account): String = "5.7"
}

data class Account(
    val iban: String,
    val currency: UUID
)

@paptimuslun
Copy link

Apollo updated their graphql-java-tools example within https://github.com/apollographql/federation-jvm/tree/master/spring-example a few weeks ago.

I also have an example of a federation + 2 graphql-spring-boot services over at https://github.com/setchy/spring-boot-federation-example

Hopefully these are good resources to help you our @amarflybot18

While on the topic, I have raised a separate enhancement in Apollo federation-jvm to simplify the amount of boilerplate code needed - apollographql/federation-jvm#108

Do you have any idea to use Dataloader in ReferenceResolver?

@PhilippS93
Copy link

Any plans to merge this feature @oliemansm ?
Thank you!

@oliemansm
Copy link
Member

There aren't any plans to work on this atm. If somebody has the time to create a PR for this I'm happy to merge it though.

@stengvac
Copy link

stengvac commented Aug 30, 2022

There aren't any plans to work on this atm. If somebody has the time to create a PR for this I'm happy to merge it though.

Are there requirements on how it should work? Introducing new interface/reusing some. As I have made example #395 (comment) is it ok to work like this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants