Skip to content

Commit

Permalink
🐛 swaager 문서를 조회되지 않는 문제 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
K-jun98 committed Sep 26, 2023
1 parent 64fec80 commit 913a11f
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 문서"
Expand All @@ -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 {
Expand All @@ -183,8 +187,10 @@ task copyDocs {
}

bootJar {
dependsOn tasks.withType(GenerateSwaggerUI)
dependsOn(':copyDocs')
dependsOn generateSwaggerUISample
from("${generateSwaggerUISample.outputDir}") {
into 'static/'
}
}

jar {
Expand Down

0 comments on commit 913a11f

Please sign in to comment.