Skip to content

Commit

Permalink
Merge pull request #29 from Alpha-mon/27-revise-swagger
Browse files Browse the repository at this point in the history
#27 - chore: swagger 문서 수정
  • Loading branch information
megymj committed Oct 15, 2023
2 parents 6386b25 + c29dc89 commit 47a3e21
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.ai.roboadvisor.domain.community.dto.response.PostDeleteResponse;
import org.ai.roboadvisor.domain.community.dto.response.PostResponse;
import org.ai.roboadvisor.domain.community.service.PostService;
import org.ai.roboadvisor.domain.community.swagger_annotation.post.delete.delete_BAD_REQUEST;
import org.ai.roboadvisor.domain.community.swagger_annotation.post.delete.delete_OK;
import org.ai.roboadvisor.domain.community.swagger_annotation.post.delete.delete_UNAUTHORIZED;
import org.ai.roboadvisor.domain.community.swagger_annotation.post.getPostById.getPostById_BAD_REQUEST;
Expand Down Expand Up @@ -81,6 +82,7 @@ public ResponseEntity<SuccessApiResponse<PostResponse>> update(@PathVariable("po
Swagger 문서 하단의 Schemas 중 RequestBody로 'PostDeleteRequest' 를 사용한다.
""")
@delete_OK
@delete_BAD_REQUEST
@delete_UNAUTHORIZED
@ApiResponse_Internal_Server_Error
@DeleteMapping("/{postId}")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package org.ai.roboadvisor.domain.community.swagger_annotation.post.delete;

import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.ExampleObject;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import org.ai.roboadvisor.global.common.dto.SuccessApiResponse;

import java.lang.annotation.*;

@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@ApiResponse(responseCode = "400", description = "게시글 번호가 잘못 입력된 경우, 혹은 존재하지 않는 경우",
content = @Content(schema = @Schema(implementation = SuccessApiResponse.class),
examples =
@ExampleObject(name = "example",
description = "게시글 번호가 잘못 입력된 경우, 혹은 존재하지 않는 경우 예시",
value = """
{
"code": 400,
"message": "요청하신 게시글 id가 존재하지 않습니다.",
"data": null
}
"""
)

))
public @interface delete_BAD_REQUEST {
}

Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@ApiResponse(responseCode = "400", description = """
투자 성향이 LION(공격투자형), SNAKE(적극투자형), MONKEY(위험중립형), SHEEP(안정추구형) 외에 다른 값이 들어온 경우,
PostRequest 요청으로 입력된 사용자의 닉네임 정보가 db에 존재하지 않는 경우.
즉, 존재하지 않는 투자 성향이 입력된 경우
즉, 사용자가 존재하지 않는 경우
""",
content = @Content(schema = @Schema(implementation = SuccessApiResponse.class),
examples = @ExampleObject(name = "example",
description = "투자 성향이 잘못 입력된 경우 예시",
description = "사용자가 존재하지 않는 경우 예시",
value = """
{
"code": 400,
"message": "잘못된 투자 성향 형식이 입력되었습니다",
"message": "가입된 사용자의 정보가 존재하지 않습니다",
"data": null
}
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,21 @@
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@ApiResponse(responseCode = "400", description = """
투자 성향이 LION(공격투자형), SNAKE(적극투자형), MONKEY(위험중립형), SHEEP(안정추구형) 외에 다른 값이 들어온 경우,
즉, 존재하지 않는 투자 성향이 입력된 경우
""",
@ApiResponse(responseCode = "400", description = "게시글 번호가 잘못 입력된 경우, 혹은 존재하지 않는 경우",
content = @Content(schema = @Schema(implementation = SuccessApiResponse.class),
examples = @ExampleObject(name = "example",
description = "투자 성향이 잘못 입력된 경우 예시",
examples =
@ExampleObject(name = "example",
description = "게시글 번호가 잘못 입력된 경우, 혹은 존재하지 않는 경우 예시",
value = """
{
"code": 400,
"message": "잘못된 투자 성향 형식이 입력되었습니다",
"data": null
"code": 400,
"message": "요청하신 게시글 id가 존재하지 않습니다.",
"data": null
}
"""
)))
)

))
public @interface update_BAD_REQUEST {
}

0 comments on commit 47a3e21

Please sign in to comment.