-
Notifications
You must be signed in to change notification settings - Fork 651
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No apollo code generation for gql operations? #5550
Comments
Hi 👋
apollo {
// For each API endpoint we have a different apollo service setup
service("backendApi") {
sourceFolder.set("graphql/backend-api")
}
} to have the compiler pick up the GraphQL queries. Alternatively, you can also remove Let me know how that works |
Hi @martinbonnin 👋, thank you so much for your response ❤️. After disabling
Codegen for backendApi seems to stop working 😞. Can you please tell me how to deal with multiple services? I thought that this is what |
Indeed, if you want multiple services, you'll need apollo {
service("backendApi") {
generateKotlinModels.set(true)
sourceFolder.set("backend-api")
packageName.set("com.backend.api.apollo.codegen")
}
service("cmsApi") {
generateKotlinModels.set(true)
sourceFolder.set("cms-api")
packageName.set("com.cms.api.apollo.codegen")
introspection {
endpointUrl.set("https://url.to.my.cms/graphql")
schemaFile.set(file("src/commonMain/graphql/cms-api/schema.graphqls"))
}
}
} Hope this helps! |
Thanks a lot @martinbonnin. Your proposal solves 100% of the issues I had 🙂🙌. You saved my day. |
Awesome, glad to hear that and thanks for the follow up 🎉 ! |
Question
I have a Kotlin Multiplatform project and I setup my Apollo Client within my
shared/build.gradle.kts
like this:Running
./gradlew build
generates me all the types as expected. But no operations written insrc/commonMain/graphql/backend-api
are generated.I have a query operation within
src/commonMain/graphql/backend-api/GetUserTest.graphql
looking like this:Can you please tell me what I am doing wrong and why there is no code generation for
GetUserTest
like in your samples?The text was updated successfully, but these errors were encountered: