Skip to content

Commit

Permalink
Merge pull request #44 from dnd-side-project/docs/#41
Browse files Browse the repository at this point in the history
#41 Swagger Update
  • Loading branch information
min-0 authored Sep 6, 2024
2 parents ff2fa51 + 7b8f68b commit ffb4b45
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
package com.dnd.dndtravel.auth.controller.request;

import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;

/*
클라이언트에서 서버로 보내는 요청
*/
public record AppleWithdrawRequest(
@NotBlank(message = "인증 코드가 존재하지 않습니다.")
@Size(max = 300, message = "인증 코드 길이를 초과하였습니다.")
@Schema(description = "authorization code", requiredMode = REQUIRED)
@NotBlank(message = "authorization code는 필수 입니다.")
@Size(max = 300, message = "authorization code 형식이 아닙니다.")
String authorizationCode
) {
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.dnd.dndtravel.auth.controller.swagger;

import com.dnd.dndtravel.auth.controller.request.AppleWithdrawRequest;
import com.dnd.dndtravel.config.AuthenticationMember;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;

Expand Down Expand Up @@ -64,4 +66,28 @@ ReissueTokenResponse reissueToken(
@Parameter(description = "refreshToken", required = true)
ReIssueTokenRequest reissueTokenRequest
);

@Operation(
summary = "애플 회원 탈퇴 API"
)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "정상적으로 탈퇴 되었습니다."),
@ApiResponse(responseCode = "400", description = "인증 실패 또는 유효하지 않은 요청",
content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
schema = @Schema(example = STATUS_CODE_400_BODY_MESSAGE)
)
),
@ApiResponse(
responseCode = "500", description = "서버 오류",
content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
schema = @Schema(example = "{\"message\":\"Internal Server Error\"}")
)
)
})
void withdraw(
@Parameter(description = "요청 정보(authorization code)", required = true)
AppleWithdrawRequest appleWithdrawRequest,
@Parameter(hidden = true)
AuthenticationMember authenticationMember
);
}
25 changes: 24 additions & 1 deletion src/main/java/com/dnd/dndtravel/config/SwaggerConfig.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package com.dnd.dndtravel.config;

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 org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

Expand All @@ -14,6 +17,26 @@ public OpenAPI openAPI() {
.info(new Info()
.title("MAPDDANG API")
.description("맵땅 앱 관련 API")
.version("1.0.0"));
.version("1.0.0"))
.addSecurityItem(new SecurityRequirement()
.addList("Access Token")
.addList("Refresh Token"))
.components(new Components()
.addSecuritySchemes("Access Token", createAccessTokenScheme())
.addSecuritySchemes("Refresh Token", createRefreshTokenScheme()));
}

private SecurityScheme createAccessTokenScheme() {
return new SecurityScheme().type(SecurityScheme.Type.HTTP)
.bearerFormat("JWT")
.scheme("bearer")
.description("Access Token");
}

private SecurityScheme createRefreshTokenScheme() {
return new SecurityScheme().type(SecurityScheme.Type.HTTP)
.bearerFormat("JWT")
.scheme("bearer")
.description("Refresh Token");
}
}

0 comments on commit ffb4b45

Please sign in to comment.