Skip to content

Commit

Permalink
feat: swagger-ui-spec에 putImage request 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
belljun3395 committed Jun 27, 2024
1 parent c3f11b2 commit 2dd45f3
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2dd45f3

Please sign in to comment.