Reputation: 6107
I am using Apollo Client in Android Project. I have 2 schema file and I have put them 2 different directories.
But when I build a project to generate code by Apollo It gives me an error:
ApolloGraphQL: By default, only one schema.json file is supported.
and suggest me to use multiple service Build output:
ApolloGraphQL: By default, only one schema.json file is supported. Please use multiple services instead:
apollo {
service("search") {
sourceFolder = "/.../app/src/main/graphql/com/example/data/search"
}
service("customer") {
sourceFolder = "/.../app/src/main/graphql/com/example/data/customer"
}
}
I have also added this to my build.gradle
(app level) file but still shows the same build error.
Please suggest me how can I solve this error
Upvotes: 4
Views: 3940
Reputation: 6107
My Problem was resolved with this configuration
apollo {
// configure ApolloExtension here
generateKotlinModels.set(false) // Generate Kotlin models for all services
service("search") {
sourceFolder.set("com/example/data/search")
rootPackageName.set("com.example.data.search")
}
service("customer") {
sourceFolder.set("com/example/data/customer")
rootPackageName.set("com.example.data.customer")
}
onCompilationUnit {
// Overwrite some options here for single CompilationUnit if needed
}
}
Hope this may help others
Upvotes: 8