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

Not able to generate pojo for 2 graphql endpoint in a project #212

Open soumyarsamal opened 1 month ago

soumyarsamal commented 1 month ago

Hi Team, We tried generating POJO for two graphql endpoint in a single project, we are able to generate pojo but it is creating duplicate class names under folder target/generated-sources/graphql-java-generator which is failing on compile time

duplicate classes are of folder(annotations, customscaler,execption,server.Util,util)

-> we tried generating both endpoint POJO on a single folder but it is only generating for the first task under execution tag

Question: how to not generate com.graphQl_java_generator folder for second schema

Below we have mentioned our pom.xml and attached screenshot for reference

Please help us resolving our issue

WhatsApp Image 2024-06-04 at 12 05 22 PM

‹plugin> ‹groupId>com.graphql-java-generator «artifactId>graphql-maven-plugin «version>1.17.3‹/version> ‹executions> ‹execution>

cam

‹configuration> «targetSourceFolder>target/generated-sources/graphql-naven-plugin/can «schemaFileFolder>src/test/resources/gql/files/cam/ ‹generateJPAAnnotation>false‹/generateJPAAnnotation> «schemaFilePattern>*.graphql «separateUtilityClasses>trues/separateUtilityclasses> ‹packageName>model.gql.cam «generateDeprecatedRequestResponse>false ‹mode>server «skipGenerationIfSchemaHasNotChanged>false

true

‹goals> ‹goal-generatePojo ‹/execution> sexecution>

gl

«configuration> < targetSourceFolder»target/generated-sources/graphql-maven-plugin/gl</targetsourceFolder» «SChemaFileFolder>src/test/resources/gql/g/${environment}/</schemaFiLeFoLder» «generateJPAAnnotation>false «schemaFilePattern>*.graphql «separateUtilityClasses>trues/separateutilityCLasses> ‹packageName>model.gql.gl≤/packageName> «generateDeprecatedRequestResponse>false‹/generateDeprecatedRequestResponse> ‹mode>server «skipGenerationIfSchemaHasNotChanged>false caddRelayConnections>true‹/addRelayConnections> ‹goals> ‹goal>generatePojo </ goals> ‹/execution>

@mjohnston-il , @DirkMahler @gonzalogomezgarcia @johanngoltz @johanngoltz
Alehandroalex commented 1 month ago

I faced the same issue when trying to use second schema

etienne-sf commented 4 weeks ago

Hello,

Did you check the client_more_than_one_graphql_servers doc ?

The two important things to manage, here are:

In the provided conf, the first condition is met, but not the second one.

Etienne

soumyarsamal commented 3 weeks ago

Hello Etienne,

Thanks for your response.

We have a non spring application, so springBeanSuffix is of no use

We have already provided targetSourceFolder but due to duplicate class names under com.graphql_java_generator we are getting compilation error (please refer above screenshot)

Is there any way we resolve this issue ?

etienne-sf commented 3 weeks ago

Hello,

I think you have no choice here, but use springBeanSuffix, and what's described in this page