Summary
On following the readme the generated Query class does not have a .builder() method.
I don't think this is a bug, more of a question on what did I missed?
Description
Steps to get there:
app/src/main/graphql/com/githubschema.json of the GitHub api using Apollo client download in the folderquery LoginViewer {
viewer {
login
}
}
(This is the helloworld of GitHub api - returns the user login string.)
./gradlew generateApolloClasses (success, class class LoginViewerQuery : Query<LoginViewerQuery.Data, LoginViewerQuery.Data, Operation.Variables> generated)LoginViewerQuery.builder() the error is: Unresolved reference: builderVersion
1.2.2
My bad - seems builder is not provided when there are no variables to "build". Just had to instantiate the class for the ApolloClient().query() method.
This should be shown more prominently in the README. I had just a single variable and even then you don't get a builder. Took me some time to find this issue. Maybe a small text should be added to the "Consuming Code"-Section so people don't get confused by the builder not being available.
The problem continues. After searching and trying I solved it!
// Replace:
apollo {
generateKotlinModels.set(true)
}
// With:
apollo {
generateModelBuilder = true
}
Most helpful comment
My bad - seems builder is not provided when there are no variables to "build". Just had to instantiate the class for the ApolloClient().query() method.