From b20a846b452eb2e586f8a760ea604cabca514dae Mon Sep 17 00:00:00 2001 From: Zoe Maas Date: Mon, 28 Oct 2024 17:46:05 +0100 Subject: [PATCH] fix: Fixed the mangled filed names in JS --- modules/openapi/build.gradle.kts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/modules/openapi/build.gradle.kts b/modules/openapi/build.gradle.kts index a1d126f7..b1df3069 100644 --- a/modules/openapi/build.gradle.kts +++ b/modules/openapi/build.gradle.kts @@ -37,6 +37,18 @@ kotlin { "kotlinx.serialization.json.JsonObject" ) } + filter { line: String -> + line.replace( + regex = Regex("(@SerialName\\(value = \\\"(\\w+)\\\"\\))"), + replacement = "@JsName(\"$2\") $1" + ) + } + filter { line: String -> + line.replace( + regex = Regex("(import kotlinx\\.serialization\\.\\*)"), + replacement = "$1 \nimport kotlin.js.JsName" + ) + } } withType {