-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from wafflestudio/feat/swagger-init
Swagger init settings
- Loading branch information
Showing
16 changed files
with
124 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/main/kotlin/com/example/toyTeam6Airbnb/SwaggerConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.example.toyTeam6Airbnb | ||
|
||
import io.swagger.v3.oas.annotations.OpenAPIDefinition | ||
import io.swagger.v3.oas.models.Components | ||
import io.swagger.v3.oas.models.OpenAPI | ||
import io.swagger.v3.oas.models.info.Info | ||
import io.swagger.v3.oas.models.security.SecurityRequirement | ||
import io.swagger.v3.oas.models.security.SecurityScheme | ||
import io.swagger.v3.oas.models.security.SecurityScheme.Type | ||
import io.swagger.v3.oas.models.servers.Server | ||
import org.springframework.context.annotation.Bean | ||
import org.springframework.context.annotation.Configuration | ||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer | ||
|
||
@Configuration | ||
@OpenAPIDefinition( | ||
info = io.swagger.v3.oas.annotations.info.Info( | ||
title = "Airbnb API", | ||
version = "1.0" | ||
) | ||
) | ||
class SwaggerConfig : WebMvcConfigurer { | ||
|
||
@Bean | ||
fun openAPI(): OpenAPI { | ||
return OpenAPI() | ||
.addSecurityItem( | ||
SecurityRequirement().addList("Bearer Authentication") | ||
) | ||
.components( | ||
Components().addSecuritySchemes | ||
("Bearer Authentication", createAPIKeyScheme()) | ||
) | ||
.addServersItem(Server().url("/")) | ||
.info( | ||
Info().title("WEBTOON API") | ||
.description("Webtoon API Spec") | ||
.version("v1.0.0") | ||
) | ||
} | ||
|
||
fun createAPIKeyScheme(): SecurityScheme? { | ||
return SecurityScheme().type(Type.HTTP) | ||
.bearerFormat("JWT") | ||
.scheme("bearer") | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/kotlin/com/example/toyTeam6Airbnb/profile/controller/ProfileController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
package com.example.toyTeam6Airbnb.profile.controller | ||
|
||
import org.springframework.web.bind.annotation.RequestMapping | ||
import org.springframework.web.bind.annotation.RestController | ||
|
||
@RestController | ||
@RequestMapping("/api/v1") | ||
class ProfileController |
5 changes: 4 additions & 1 deletion
5
src/main/kotlin/com/example/toyTeam6Airbnb/profile/service/ProfileServiceImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
package com.example.toyTeam6Airbnb.profile.service | ||
|
||
class ProfileServiceImpl | ||
import org.springframework.stereotype.Service | ||
|
||
@Service | ||
class ProfileServiceImpl : ProfileService |
5 changes: 5 additions & 0 deletions
5
src/main/kotlin/com/example/toyTeam6Airbnb/reservation/controller/ReservationController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
package com.example.toyTeam6Airbnb.reservation.controller | ||
|
||
import org.springframework.web.bind.annotation.RequestMapping | ||
import org.springframework.web.bind.annotation.RestController | ||
|
||
@RestController | ||
@RequestMapping("/api/v1") | ||
class ReservationController |
5 changes: 4 additions & 1 deletion
5
src/main/kotlin/com/example/toyTeam6Airbnb/reservation/service/ReservationServiceImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
package com.example.toyTeam6Airbnb.reservation.service | ||
|
||
class ReservationServiceImpl | ||
import org.springframework.stereotype.Service | ||
|
||
@Service | ||
class ReservationServiceImpl : ReservationService |
5 changes: 5 additions & 0 deletions
5
src/main/kotlin/com/example/toyTeam6Airbnb/review/controller/ReviewController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
package com.example.toyTeam6Airbnb.review.controller | ||
|
||
import org.springframework.web.bind.annotation.RequestMapping | ||
import org.springframework.web.bind.annotation.RestController | ||
|
||
@RestController | ||
@RequestMapping("/api/v1") | ||
class ReviewController |
5 changes: 4 additions & 1 deletion
5
src/main/kotlin/com/example/toyTeam6Airbnb/review/service/ReviewServiceImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
package com.example.toyTeam6Airbnb.review.service | ||
|
||
class ReviewServiceImpl | ||
import org.springframework.stereotype.Service | ||
|
||
@Service | ||
class ReviewServiceImpl : ReviewService |
5 changes: 5 additions & 0 deletions
5
src/main/kotlin/com/example/toyTeam6Airbnb/room/controller/RoomController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
package com.example.toyTeam6Airbnb.room.controller | ||
|
||
import org.springframework.web.bind.annotation.RequestMapping | ||
import org.springframework.web.bind.annotation.RestController | ||
|
||
@RestController | ||
@RequestMapping("/api/v1") | ||
class RoomController |
5 changes: 4 additions & 1 deletion
5
src/main/kotlin/com/example/toyTeam6Airbnb/room/service/RoomServiceImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
package com.example.toyTeam6Airbnb.room.service | ||
|
||
class RoomServiceImpl | ||
import org.springframework.stereotype.Service | ||
|
||
@Service | ||
class RoomServiceImpl : RoomService |
21 changes: 20 additions & 1 deletion
21
src/main/kotlin/com/example/toyTeam6Airbnb/user/controller/UserController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,22 @@ | ||
package com.example.toyTeam6Airbnb.user.controller | ||
|
||
class UserController | ||
import com.example.toyTeam6Airbnb.user.service.UserService | ||
import io.swagger.v3.oas.annotations.Operation | ||
import io.swagger.v3.oas.annotations.tags.Tag | ||
import org.springframework.http.ResponseEntity | ||
import org.springframework.web.bind.annotation.PostMapping | ||
import org.springframework.web.bind.annotation.RequestMapping | ||
import org.springframework.web.bind.annotation.RestController | ||
|
||
@RestController | ||
@RequestMapping("/api/v1") | ||
@Tag(name = "User Controller", description = "User Controller API") | ||
class UserController( | ||
private val userService: UserService | ||
) { | ||
@PostMapping("/ping") | ||
@Operation(summary = "Ping pong", description = "Sample ping pong api for testing") | ||
fun ping(): ResponseEntity<String> { | ||
return ResponseEntity.ok("pong") | ||
} | ||
} |
5 changes: 4 additions & 1 deletion
5
src/main/kotlin/com/example/toyTeam6Airbnb/user/service/UserServiceImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
package com.example.toyTeam6Airbnb.user.service | ||
|
||
class UserServiceImpl | ||
import org.springframework.stereotype.Service | ||
|
||
@Service | ||
class UserServiceImpl : UserService |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
### Pingpong | ||
POST http://localhost:8080/api/v1/ping | ||
Content-Type: application/json | ||
|
||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters