From cff4debe384f6662a09523ef61f2b40bbc368c40 Mon Sep 17 00:00:00 2001 From: dzikoysk Date: Wed, 25 Sep 2024 20:44:59 +0200 Subject: [PATCH] GH-231 Support fallback to 'default' version when .index file is missing (Resolve #231) --- .../src/main/kotlin/io/javalin/openapi/OpenApiAnnotations.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openapi-specification/src/main/kotlin/io/javalin/openapi/OpenApiAnnotations.kt b/openapi-specification/src/main/kotlin/io/javalin/openapi/OpenApiAnnotations.kt index 4282a21..e23767e 100644 --- a/openapi-specification/src/main/kotlin/io/javalin/openapi/OpenApiAnnotations.kt +++ b/openapi-specification/src/main/kotlin/io/javalin/openapi/OpenApiAnnotations.kt @@ -302,7 +302,9 @@ enum class HttpMethod { class OpenApiLoader { fun loadOpenApiSchemes(): Map = - loadVersions().associateWith { loadVersion(it) ?: "{}" } + loadVersions() + .ifEmpty { setOf("default") } + .associateWith { loadVersion(it) ?: "{}" } fun loadVersions(): Set = OpenApiLoader::class.java.getResourceAsStream("/openapi-plugin/.index")