graphql-java-generator / graphql-maven-plugin-project

graphql-maven-plugin is a Maven Plugin for GraphQL, based on graphql-java. It accelerates the development for both the client and the server, by generating the Java code. It allows a quicker development when in contract-first approach, by avoiding to code the boilerplate code.
https://graphql-maven-plugin-project.graphql-java-generator.com
MIT License
115 stars 47 forks source link

queries on multiple endpoints on the same server #201

Closed avmr48shadow closed 8 months ago

avmr48shadow commented 8 months ago

Hi,

I use the client generator to query 3 things. The problem is, they are exposed on 3 different endpoints on the server.

I use a @GraphQLRepository which is really great.

Do you know a workaround to be able to attach each method to a specific endpoint. I've tried some things but nothing elegant.

Thank you very much.

avmr48shadow commented 8 months ago

I've seen this page : https://github.com/graphql-java-generator/graphql-maven-plugin-project/wiki/client_more_than_one_graphql_servers

I have a probleme with that :

the different endpoints share some common schema also

etienne-sf commented 8 months ago

Hello,

This link should answer your question: https://github.com/graphql-java-generator/graphql-maven-plugin-project/wiki/client_graphql_repository#using-graphql-repositories-with-spring-against-several-graphql-servers

The idea is, when you define a GraphQLRepository, is that one GraphQLRepository can query only one GraphQL server. So, as you have three such servers, you must have three GraphQLRepositories.

Edit: if I understand correctly your last message, there are common types (enums...) between these three schemas. There is currently no way to mix POJOs between two code generation by the plugin (coming from different GraphQL schemas). You can use the dozer library on this use case. This library allows to map an object from one class to another one.

Étienne