Skip to content

Commit

Permalink
Fix bug with schema jar files (#733)
Browse files Browse the repository at this point in the history
When using schemaJarFilesFromDependencies, the ZipFile was closed before
the reader had read the actual schema file, resulting in an IOException
being thrown.
  • Loading branch information
kilink authored Aug 19, 2024
1 parent 69f01a1 commit 0a71297
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,13 @@ class CodeGen(private val config: CodeGenConfig) {
loadSchemaReaders(readerBuilder, debugReaderBuilder)
// process schema from dependencies
config.schemaJarFilesFromDependencies.forEach { file ->
ZipFile(file).use { zipFile ->
for (entry in zipFile.entries()) {
if (!entry.isDirectory && entry.name.startsWith("META-INF") &&
(entry.name.endsWith(".graphqls") || entry.name.endsWith(".graphql"))
) {
logger.info("Generating schema from {}: {}", file.name, entry.name)
readerBuilder.reader(zipFile.getInputStream(entry).reader(), "codegen")
}
val zipFile = ZipFile(file)
for (entry in zipFile.entries()) {
if (!entry.isDirectory && entry.name.startsWith("META-INF") &&
(entry.name.endsWith(".graphqls") || entry.name.endsWith(".graphql"))
) {
logger.info("Generating schema from {}: {}", file.name, entry.name)
readerBuilder.reader(zipFile.getInputStream(entry).reader(), "codegen")
}
}
}
Expand Down

0 comments on commit 0a71297

Please sign in to comment.