How to generate clients for different services #746
Replies: 3 comments 7 replies
-
Are you able to separate your services into different modules, each with it's own build.gradle file? Then you can define a separate task for each service, which will solve your issue. That is how we address this issue for multiple services in the same project. |
Beta Was this translation helpful? Give feedback.
-
Hello - We are running into the same problem. Consider this scenario:
I too am running into errors like:
We are using Gradle and I have broken out the schema generation into their own gradle sub projects whose only responsibility is to generate the schema. For example:
Then in my main gradle project, I have this: However the error is thrown from Thoughts? |
Beta Was this translation helpful? Give feedback.
-
Here is how we generate clients for 2 sub graphs in the same gradle build file
Works as the pojos are generated in different java packages and conflict free |
Beta Was this translation helpful? Give feedback.
-
I need clients for multiple services.
duplicating the "generatedJava"-Task does not work, because only each task run is deleting the older ones.
Including multiple schema files will cause duplicate variable names in DgsConstants.kt.
DgsConstants.kt: (112, 17): Conflicting declarations: public object QUERY, public object QUERY
generateJava {
schemaPaths = mutableListOf(
"${rootDir}/academy-service/src/main/resources/graphql/schema.graphqls",
"${rootDir}/user-service/src/main/resources/graphql/schema.graphqls",
)
packageName = "de.example.service.client.graphql"
generateClient = true
}
thanks for some tips
Beta Was this translation helpful? Give feedback.
All reactions