Closed dannylagrouw closed 8 months ago
Hi 👋
apollo {
service("starwars") {
packageName.set("com.starwars")
introspection {
endpointUrl.set("https://your.domain/graphql/endpoint")
schemaFile.set(file("src/main/graphql/com/example/schema.graphqls"))
}
}
}
Could it be that schemaFile
here resolves to something else than introspection.schemaFile
? There is also a service.schemaFile
so it's easy to have scoping errors here.
If not, could you share a small reproducer? I tried to reproduce here without success so far.
Ah, nevermind, I think I have it. 2 tasks are created:
downloadApolloSchema
is to be called with CLI arguments:./gradlew downloadApolloSchema --schema schema.graphqls --endpoint https://example.com/graphql
downloadStarwarsApolloSchemaFromIntrospection
is using the values from the Gradle script./gradlew downloadStarwarsApolloSchemaFromIntrospection
Can you confirm if it's what's happening?
Agree this is confusing and in the long run I'd like to remove the CLI one for a proper one alas removing stuff always take times so we'll get there. In the meantime, I'll add a note in the docs to guard against this.
Hmm, I don't have a downloadStarwarsApolloSchemaFromIntrospection
(or any task download...FromIntrospection
), just the downloadApolloSchema
.
Can you share your Gradle configuration?
Interesting. I went back to re-create the introspection setup so I could show you and... the ...FromIntrospection
task appeared. And worked fine as well. So just a clarification in the docs would probably clear all this up. Thanks for helping!
👍 thanks for the update. Note added in the docs there
I'll close this one for now, please let us know if you bump into other issues.
Version
3.8.2
Summary
Downloading a schema, as described in the docs (https://www.apollographql.com/docs/kotlin/advanced/plugin-configuration) results in an error because of a missing schema property. Creating my own download task shows that the projectRootDir property is also missing.
Steps to reproduce the behavior
When trying to download a schema, as described in the docs (https://www.apollographql.com/docs/kotlin/advanced/plugin-configuration):
I get an error:
Maybe because the
schema
property in the download task is not being set inDefaultApolloExtension
?Alternatively, I tried creating my own task:
This results in a cryptic:
In the end I found from the source that the
projectRootDir
property inApolloDownloadSchemaTask
is not initialized either. When I addprojectRootDir = project.projectDir.absolutePath
to my task, it finally works.Logs
No response