dgs-codegen
dgs-codegen copied to clipboard
Gradle Task To Fetch And Update Schema By URI
Hi, I'm using Kotlin And Gradle, I would like to fetch schema using a Gradle task and update it in the specific path in the project.
I found such capability in ExpediaGroup lib id("com.expediagroup.graphql"), but didn't find a matching solution in dgs-codegen, val tempSchemaDownload by tasks.creating(com.expediagroup.graphql.plugin.gradle.tasks.GraphQLDownloadSDLTask::class) { endpoint.set("http://...") outputFile.set(project.layout.buildDirectory.file("schema.graphql")) }
Please advise if there's a way and I'm missing something
We don't have the ability to fetch a schema from a URI. There is a way to include schema files from dependency JARs but not to fetch remote schemas.
Hi, I'm using Kotlin And Gradle, too
The client module is trying to use dgsCodegen
.
build.gradle.kts ...
plugins {
id("com.netflix.dgs.codegen")
}
dependencies {
dgsCodegen(project(":apps:api"))
}
tasks.withType<com.netflix.graphql.dgs.codegen.gradle.GenerateJavaTask> {
generateClientv2 = true
generatedSourcesDir = project.buildDir.absolutePath
packageName = "com.zshp.agg.stream"
typeMapping = mutableMapOf(
// Scalar
"Long" to "kotlin.Long",
"BigDecimal" to "java.math.BigDecimal",
"DateTime" to "java.time.OffsetDateTime"
)
}
dgsCodegen
is not working. can't you support bringing it within the multi-module?
Please advise if there's a way and I'm missing something
Are you using the latest release? That would be the first thing to check since we had to revert a change that affcted this feature.
If it's still not working: Usually you need the group id and artifact for specifying the dependency like so
dependencies {
// other dependencies
dgsCodegen 'com.netflix.graphql.dgs:example-schema:x.x.x'
}
I don't think it would work with the internal module as you have specified, we haven't explicitly tried to support that.