Skip to content

Commit

Permalink
Merge pull request #8 from taco-official/KL-63/swagger-연동
Browse files Browse the repository at this point in the history
feat(KL-63): connect Swagger
  • Loading branch information
ohhamma authored Jul 17, 2024
2 parents 8862221 + cf930e4 commit 1b0e3dd
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 39 deletions.
5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@ repositories {

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-security'
// implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.4'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.h2database:h2'
runtimeOnly 'com.mysql:mysql-connector-j'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
// testImplementation 'org.springframework.security:spring-security-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}

Expand Down
28 changes: 28 additions & 0 deletions src/main/java/taco/klkl/global/config/swagger/SwaggerConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package taco.klkl.global.config.swagger;

import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.annotations.info.Info;
import lombok.RequiredArgsConstructor;

@OpenAPIDefinition(
info = @Info(title = "끼룩끼룩 API 명세서",
description = "TACO 끼룩끼룩 API 명세서",
version = "v1"))
@RequiredArgsConstructor
@Configuration
public class SwaggerConfig {
@Bean
public GroupedOpenApi KlklOpenApi() {
// "/v1/**" 경로에 매칭되는 API를 그룹화하여 문서화한다.
String[] paths = {"/v1/**"};

return GroupedOpenApi.builder()
.group("끼룩끼룩 API v1") // 그룹 이름을 설정한다.
.pathsToMatch(paths) // 그룹에 속하는 경로 패턴을 지정한다.
.build();
}
}
21 changes: 0 additions & 21 deletions src/main/java/taco/klkl/security/SecurityConfig.java

This file was deleted.

20 changes: 20 additions & 0 deletions src/main/resources/application-h2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
spring:
# H2 Setting Info (H2 Console에 접속하기 위한 설정정보 입력)
h2:
console:
enabled: true # H2 Console을 사용할지 여부 (H2 Console은 H2 Database를 UI로 제공해주는 기능)
path: /h2-console # H2 Console의 Path
# Database Setting Info (Database를 H2로 사용하기 위해 H2연결 정보 입력)
datasource:
driver-class-name: org.h2.Driver
url: jdbc:h2:mem:klkldb
username: sa
password:
jpa:
database-platform: org.hibernate.dialect.H2Dialect
hibernate:
ddl-auto: create
properties:
hibernate:
show-sql: true
format-sql: true
16 changes: 16 additions & 0 deletions src/main/resources/application-swagger.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
spring:
springdoc:
swagger-ui:
tags-sorter: alpha
operations-sorter: method
path: /swagger-ui/index.html
disable-swagger-default-url: true
display-query-params-without-oauth2: true
doc-expansion: none
urls-primary-name: KLKL API DOCS
api-docs:
path: /api-docs
default-consumes-media-type: application/json;charset=UTF-8
default-produces-media-type: application/json;charset=UTF-8
paths-to-match:
- /v1/**
16 changes: 0 additions & 16 deletions src/main/resources/application.properties

This file was deleted.

8 changes: 8 additions & 0 deletions src/main/resources/application.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
spring:
profiles:
include:
- h2
- swagger

application:
name: klkl

0 comments on commit 1b0e3dd

Please sign in to comment.