Skip to content

Commit

Permalink
Merge pull request #6 from Team-UMC/feature/#5/swagger
Browse files Browse the repository at this point in the history
[FEAT] Swagger setting
  • Loading branch information
junseokkim authored Jan 6, 2024
2 parents ff82ee5 + 0682fc3 commit 9dbf2e4
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/umc-service-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ jobs:
script: |
cd /
sudo docker-compose -f docker-compose.dev.yml down
sudo docker pull ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO }}-dev
sudo docker pull ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO }}-dev
sudo docker-compose -f docker-compose.dev.yml up -d
sudo docker image prune -f
2 changes: 1 addition & 1 deletion .github/workflows/umc-service-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ jobs:
port: 22
script: |
sudo docker-compose -f docker-compose.prod.yml down
sudo docker pull ${{ secrets.DOCKER_REPO }}
sudo docker pull ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO }}
sudo docker-compose -f docker-compose.prod.yml up -d
sudo docker image prune -f
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,4 @@ out/
### VS Code ###
.vscode/

.env
application.yml
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM openjdk:17
ARG JAR_FILE=build/libs/*.jar
COPY ${JAR_FILE} flory.jar
ENTRYPOINT ["java","-jar","/flory.jar"]
COPY ${JAR_FILE} umcservice.jar
ENTRYPOINT ["java","-jar","/umcservice.jar"]
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ dependencies {
runtimeOnly 'com.mysql:mysql-connector-j'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'

// swagger setting
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0'
}

tasks.named('test') {
Expand Down
24 changes: 24 additions & 0 deletions src/main/java/com/umc/networkingService/config/SwaggerConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.umc.networkingService.config;

import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SwaggerConfig {
@Bean
public OpenAPI openAPI() {
return new OpenAPI()
.components(new Components())
.info(apiInfo());
}

private Info apiInfo() {
return new Info()
.title("UMC ๋„คํŠธ์›Œํ‚น ์„œ๋น„์Šค API ๋ช…์„ธ์„œ")
.description("Swagger UI for UMC ๋„คํŠธ์›Œํ‚น ์„œ๋น„์Šค")
.version("1.0.0");
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,35 @@
package com.umc.networkingService.domain.test.controller;

import io.swagger.v3.oas.annotations.Hidden;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "์˜ˆ์ œ API", description = "Swagger ํ…Œ์ŠคํŠธ์šฉ API")
@RestController
@RequiredArgsConstructor
@RequestMapping("/test")
public class TestController {
@Operation(summary = "๋ฌธ์ž์—ด ๋ฐ˜๋ณต", description = "ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ ๋ฐ›์€ ๋ฌธ์ž์—ด์„ 2๋ฒˆ ๋ฐ˜๋ณตํ•ฉ๋‹ˆ๋‹ค.")
@Parameter(name = "str", description = "2๋ฒˆ ๋ฐ˜๋ณตํ•  ๋ฌธ์ž์—ด")
@GetMapping("/returnStr")
public String returnStr(@RequestParam String str) {
return str + "\n" + str;
}

@GetMapping("/example")
public String example() {
return "์˜ˆ์‹œ API";
}

@GetMapping
public String getTest() {
return "kimjunseok";
@Hidden
@GetMapping("/ignore")
public String ignore() {
return "๋ฌด์‹œ๋˜๋Š” API";
}
}
}

0 comments on commit 9dbf2e4

Please sign in to comment.