This is not really possible. All the code generation has to happen at compile time or you loose the ability to check the types with the Kotlin compiler.
You can execute queries at runtime sending strings and parsing responses manually but that will loose a big part of the type safety guarantees apollo Kotlin provides
Thank You @mbonnin for the reasonable explanation, currently i am using Gradle Build to compile and generate classes. is there any simple command which will generate these classes with the GraphQL files placed in some folder?
@mbonnin : A quick question out of the way though, i can see that .
actually generate these classes, i am trying in the maven based application, how do i generate the sources in maven based application.
Is there a command for it or if i need to create a target, one other way is using a Java Program and invoking gradle utility, was wondering if it could be done through mvn as well.
i tried using
mvn clean install
but it doesn’t seems to be generating the models for the corresponding graphql files.
I’m not super well versed in the maven plugin. Are you using this maven plugin? I would expect mvn install to generate them but maybe I’m missing something. Did you add the plugin to your pom.xmlas described in the doc? Can you share a small project somewhere?
I want to use to generate the Models through Maven utility also i want to understand if there is a limitation of putting all the .graphql files in src/main/graphql/ directory? Or this can be configured as well?
Yes @mbonnin this seems to work now after making the changes suggested by you.Thank You!!
Also want to check on how does other thing like downloading schema from server. I was using the following gradle command
.\gradlew downloadApolloSchema --endpoint="https://apollo-fullstack-tutorial.herokuapp.com/graphql" --schema="<Local_Schema_File_Path>"
Is there any API or introspection query as in what are the alternatives? If there is a doc link to it, please do share it.