Skip to content

Commit 14ff8b6

Browse files
committed
Docs: Swagger 문서 작성
1 parent 304b098 commit 14ff8b6

File tree

1 file changed

+141
-0
lines changed

1 file changed

+141
-0
lines changed

src/main/java/com/back/domain/board/controller/CommentControllerDocs.java

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,4 +141,145 @@ ResponseEntity<RsData<CommentResponse>> createComment(
141141
@RequestBody CommentRequest request,
142142
@AuthenticationPrincipal CustomUserDetails user
143143
);
144+
145+
@Operation(
146+
summary = "댓글 수정",
147+
description = "로그인한 사용자가 자신이 작성한 댓글을 수정합니다."
148+
)
149+
@ApiResponses({
150+
@ApiResponse(
151+
responseCode = "200",
152+
description = "댓글 수정 성공",
153+
content = @Content(
154+
mediaType = "application/json",
155+
examples = @ExampleObject(value = """
156+
{
157+
"success": true,
158+
"code": "SUCCESS_200",
159+
"message": "댓글이 수정되었습니다.",
160+
"data": {
161+
"commentId": 25,
162+
"postId": 101,
163+
"author": {
164+
"id": 5,
165+
"nickname": "홍길동"
166+
},
167+
"content": "수정된 댓글 내용입니다.",
168+
"createdAt": "2025-09-22T11:30:00",
169+
"updatedAt": "2025-09-22T13:00:00"
170+
}
171+
}
172+
""")
173+
)
174+
),
175+
@ApiResponse(
176+
responseCode = "400",
177+
description = "잘못된 요청 (필드 누락 등)",
178+
content = @Content(
179+
mediaType = "application/json",
180+
examples = @ExampleObject(value = """
181+
{
182+
"success": false,
183+
"code": "COMMON_400",
184+
"message": "잘못된 요청입니다.",
185+
"data": null
186+
}
187+
""")
188+
)
189+
),
190+
@ApiResponse(
191+
responseCode = "401",
192+
description = "인증 실패 (토큰 없음/잘못됨/만료)",
193+
content = @Content(
194+
mediaType = "application/json",
195+
examples = {
196+
@ExampleObject(name = "토큰 없음", value = """
197+
{
198+
"success": false,
199+
"code": "AUTH_001",
200+
"message": "인증이 필요합니다.",
201+
"data": null
202+
}
203+
"""),
204+
@ExampleObject(name = "잘못된 토큰", value = """
205+
{
206+
"success": false,
207+
"code": "AUTH_002",
208+
"message": "유효하지 않은 액세스 토큰입니다.",
209+
"data": null
210+
}
211+
"""),
212+
@ExampleObject(name = "만료된 토큰", value = """
213+
{
214+
"success": false,
215+
"code": "AUTH_004",
216+
"message": "만료된 액세스 토큰입니다.",
217+
"data": null
218+
}
219+
""")
220+
}
221+
)
222+
),
223+
@ApiResponse(
224+
responseCode = "403",
225+
description = "권한 없음 (작성자 아님)",
226+
content = @Content(
227+
mediaType = "application/json",
228+
examples = @ExampleObject(value = """
229+
{
230+
"success": false,
231+
"code": "COMMENT_002",
232+
"message": "댓글 작성자만 수정/삭제할 수 있습니다.",
233+
"data": null
234+
}
235+
""")
236+
)
237+
),
238+
@ApiResponse(
239+
responseCode = "404",
240+
description = "존재하지 않는 게시글 또는 댓글",
241+
content = @Content(
242+
mediaType = "application/json",
243+
examples = {
244+
@ExampleObject(name = "존재하지 않는 게시글", value = """
245+
{
246+
"success": false,
247+
"code": "POST_001",
248+
"message": "존재하지 않는 게시글입니다.",
249+
"data": null
250+
}
251+
"""),
252+
@ExampleObject(name = "존재하지 않는 댓글", value = """
253+
{
254+
"success": false,
255+
"code": "COMMENT_001",
256+
"message": "존재하지 않는 댓글입니다.",
257+
"data": null
258+
}
259+
""")
260+
}
261+
)
262+
),
263+
@ApiResponse(
264+
responseCode = "500",
265+
description = "서버 내부 오류",
266+
content = @Content(
267+
mediaType = "application/json",
268+
examples = @ExampleObject(value = """
269+
{
270+
"success": false,
271+
"code": "COMMON_500",
272+
"message": "서버 오류가 발생했습니다.",
273+
"data": null
274+
}
275+
""")
276+
)
277+
)
278+
})
279+
ResponseEntity<RsData<CommentResponse>> updateComment(
280+
@PathVariable Long postId,
281+
@PathVariable Long commentId,
282+
@RequestBody CommentRequest request,
283+
@AuthenticationPrincipal CustomUserDetails user
284+
);
144285
}

0 commit comments

Comments
 (0)