From 913a11f926dd9be721641a5830c265cdeabf2b5a Mon Sep 17 00:00:00 2001 From: jun Date: Tue, 26 Sep 2023 20:43:09 +0900 Subject: [PATCH] =?UTF-8?q?:bug:=20swaager=20=EB=AC=B8=EC=84=9C=EB=A5=BC?= =?UTF-8?q?=20=EC=A1=B0=ED=9A=8C=EB=90=98=EC=A7=80=20=EC=95=8A=EB=8A=94=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/build.gradle b/build.gradle index ea40a89..9ddd3a5 100644 --- a/build.gradle +++ b/build.gradle @@ -144,6 +144,12 @@ tasks.named('test') { useJUnitPlatform() } +swaggerSources { + sample { + setInputFile(file("${project.buildDir}/resources/main/static/backlog.yaml")) + } +} + openapi3 { server = "https://bbacklog.site" title = "API 문서" @@ -156,23 +162,21 @@ openapi3 { } tasks.withType(GenerateSwaggerUI) { - dependsOn ':openapi3' + dependsOn 'openapi3' doFirst { def swaggerUIFile = file("${openapi3.outputDirectory}/backlog.yaml") - def securitySchemesContent = " securitySchemes:\n" + - " APIKey:\n" + - " type: apiKey\n" + - " name: Authorization\n" + - " in: header\n" + - "security:\n" + + def securitySchemesContent = " securitySchemes:\n" + \ + " APIKey:\n" + \ + " type: apiKey\n" + \ + " name: Authorization\n" + \ + " in: header\n" + \ + "security:\n" + " - APIKey: [] # Apply the security scheme here" swaggerUIFile.append securitySchemesContent } -} -task copyDocs { doLast { delete 'src/main/resources/static/backlog.yaml' copy { @@ -183,8 +187,10 @@ task copyDocs { } bootJar { - dependsOn tasks.withType(GenerateSwaggerUI) - dependsOn(':copyDocs') + dependsOn generateSwaggerUISample + from("${generateSwaggerUISample.outputDir}") { + into 'static/' + } } jar {