Closed yakeem closed 3 years ago
schemaPath
is resolved differently than schemaFile
for obscure Android Variants reasons (basically the plugin supports using different schemas for different android variants which I think no one uses and complexifies the code a lot...).
To use schemaPath
, pass the path relative to src/main/graphql
: schemaPath.set("proj1/schema.json")
, this should work.
I'm planning to clean that up in the next major version but in the meantime the above should work. Let me know if it doesn't.
Hi @yakeem , did using schemaPath
help? Anything I can do here? If not, do you mind if I close this issue?
I'm closing this issue, please leave a comment if you want me to reopen it.
@martinbonnin Do we still have schemaPath
?
My .graphql
& schema.json
are in another module and when I build the project, the plugin doesn't generate the kotlin classes.
@Drjacky 3.x streamlined the Gradle configuration a lot and using schemaFile
now covers all use cases.
Usually, it's a matter of doing
apollo {
service("starwars") {
srcDir("../otherModule/src/main/graphql/starwars")
schemaFile.set(file("../otherModule/src/main/graphql/starwars/schema.graphqls"))
}
}
(edit: added schema.graphqls)
You can read more about it there: https://www.apollographql.com/docs/kotlin/advanced/plugin-configuration/
Do not hesitate to open a new issue if that doesn't work.
@martinbonnin Can we define the location of generated classes?
Imagine I want to generate the models in Module X. but I have hilt framework which needs to be in the App module.
When I want to provide ApolloClient
in a DI module in the App
module, I need apollo dependency; As far as I see, wherever we have defined the plugin, the generated classes will be created there.
Update:
I had to add the runtime dependency to the App
module.
"com.apollographql.apollo3:apollo-runtime:3.2.1"
@Drjacky Can you open a separate issue to investigate this? I'd like to keep each issue focused on one problem else the SEO becomes really weird and people ending up here will be confused.
Summary When creating multiple services and defining path to schema, one needs to use
schemaFile
property instead ofschemaPath
Version 2.3.1
Description I have following setup for my project:
However running above, it does not see my schema.json file and generates no java/kotlin classes.
When instead of
schemaPath
I'm usingschemaFile
props, then everything is generated perfectly:Am I misusing somehow
schemaPath
or is it a bug?