:wave: Nice to see a channel here on Kotlinlang :h...
# apollo-kotlin
a
👋 Nice to see a channel here on Kotlinlang ❤️ I have been trying to setup
downloadApolloSchema
task in kts for a multi module project, without success.
Copy code
apollo {
    generateKotlinModels.set(true)
    customTypeMapping.set(mapOf("Date" to "me.sphere.appcore.utils.EpochSeconds"))

    service("Service") {
        sourceFolder.set("commonMain")
        schemaPath.set("com/example/schema.json")
        introspection {
            endpointUrl.set("<https://api.example.com/graphql>")
            sourceSetName.set("commonMain") <-- This is same as sourceFolder? Do we need to declare it 2x
        }
    }
}
I'm getting:
Copy code
Execution failed for task ':appcore-apollo:downloadApolloSchema'.
> ApolloGraphQL: cannot determine where to save the schema. Specify --schema or --service
In an Android project specifying only
schemaPath
, introspection with
endpointUrl
works without any issues.
❤️ 1
m
downloadApolloSchema
is meant to be used from the commandline. Can you try
downloadSphereApolloSchema
?
a
That works as expected. Thank you.
👍 1
1
m
Regarding
sourceSetName.set("commonMain")
I "think" this is not needed for multiplatform. This is needed for Android projects where we create a compilationUnit per android variant and it can potentially have different schemas per-variant
But the multiplatform setup is simpler and doesn't try to do anything with Android variants