From 2dd45f37d91ca22218ae1f10cf3f5304fab62506 Mon Sep 17 00:00:00 2001 From: belljun3395 <195850@jnu.ac.kr> Date: Thu, 27 Jun 2024 17:27:23 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20swagger-ui-spec=EC=97=90=20putImage=20r?= =?UTF-8?q?equest=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/build.gradle.kts | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/api/build.gradle.kts b/api/build.gradle.kts index 80301bdac..eb5c4287f 100644 --- a/api/build.gradle.kts +++ b/api/build.gradle.kts @@ -59,12 +59,40 @@ tasks.withType(GenerateSwaggerUI::class) { } tasks.register("generateApiSwaggerUI", Copy::class) { - dependsOn("generateSwaggerUI") +// dependsOn("generateSwaggerUI") val generateSwaggerUISampleTask = tasks.named("generateSwaggerUIApi", GenerateSwaggerUI::class).get() from(generateSwaggerUISampleTask.outputDir) into("$projectDir/src/main/resources/static/docs/swagger-ui") + doLast { + val swaggerSpecSource = "$projectDir/src/main/resources/static/docs/swagger-ui/swagger-spec.js" + file(swaggerSpecSource).writeText( + file(swaggerSpecSource).readText().replace( + "operationId\" : \"PutImageApi\",", + "operationId\" : \"PutImageApi\",\n" + + putImageRequestScriptSource + ) + ) + } } +val putImageRequestScriptSource = "" + + " \"requestBody\" : {\n" + + " \"content\" : {\n" + + " \"multipart/form-data\" : {\n" + + " \"schema\" : {\n" + + " \"type\" : \"object\",\n" + + " \"properties\" : {\n" + + " \"source\" : {\n" + + " \"type\" : \"string\",\n" + + " \"format\" : \"binary\"\n" + + " }\n" + + " }\n" + + "\n" + + " }\n" + + " }\n" + + " }\n" + + " }," + val imageName = project.hasProperty("imageName").let { if (it) { project.property("imageName") as String