Skip to content

Commit a920ff7

Browse files
committed
fix(openapi): keep openapi yaml in resources
1 parent 4f4a7ce commit a920ff7

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

model-server/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ EXPOSE 28101
44
COPY run-model-server.sh /usr/modelix-model/
55
COPY build/dependency-libs/ /usr/modelix-model/model-server/build/libs/
66
COPY build/libs/ /usr/modelix-model/model-server/build/libs/
7-
COPY api/*.yaml /usr/modelix-model/api/
87
ENTRYPOINT ["./run-model-server.sh"]

model-server/build.gradle.kts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,18 @@ val cucumber = task("cucumber") {
120120
tasks.register<Copy>("copyApis") {
121121
from("../api/")
122122
include("*.yaml")
123-
into(project.layout.projectDirectory.dir("api"))
123+
into(project.layout.projectDirectory.dir("src/main/resources/api"))
124124
}
125125

126126
tasks.named("build") {
127127
dependsOn("cucumber")
128128
dependsOn("copyApis")
129129
}
130130

131+
tasks.named("processResources") {
132+
dependsOn("copyApis")
133+
}
134+
131135
task("copyLibs", Sync::class) {
132136
into(project.layout.buildDirectory.dir("dependency-libs"))
133137
from(configurations.runtimeClasspath)

model-server/src/main/kotlin/org/modelix/model/server/Main.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ import org.modelix.model.server.store.loadDump
6363
import org.modelix.model.server.store.writeDump
6464
import org.modelix.model.server.templates.PageWithMenuBar
6565
import org.slf4j.LoggerFactory
66+
import org.springframework.util.ResourceUtils
6667
import java.io.File
6768
import java.io.IOException
6869
import java.nio.charset.StandardCharsets
@@ -239,7 +240,7 @@ object Main {
239240
}
240241
} else {
241242
// we only serve the public API to the outside via swagger UI
242-
swaggerUI(path = "swagger", swaggerFile = "api/model-server.yaml")
243+
swaggerUI(path = "swagger", swaggerFile = ResourceUtils.getFile("api/model-server.yaml").path.toString())
243244
}
244245
}
245246
}

0 commit comments

Comments
 (0)