Skip to content

Commit 49f2586

Browse files
committed
Docs: Swagger 문서 작성
1 parent d8639f3 commit 49f2586

File tree

1 file changed

+36
-4
lines changed

1 file changed

+36
-4
lines changed

src/main/java/com/back/domain/board/post/controller/docs/PostControllerDocs.java

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ public interface PostControllerDocs {
5555
{ "id": 1, "name": "공지사항" },
5656
{ "id": 2, "name": "자유게시판" }
5757
],
58+
"images": [
59+
{ "id": 11, "url": "https://example.com/image1.png" },
60+
{ "id": 12, "url": "https://example.com/image2.png" }
61+
],
5862
"createdAt": "2025-09-22T10:30:00",
5963
"updatedAt": "2025-09-22T10:30:00"
6064
}
@@ -112,7 +116,7 @@ public interface PostControllerDocs {
112116
),
113117
@ApiResponse(
114118
responseCode = "404",
115-
description = "존재하지 않는 사용자 또는 카테고리",
119+
description = "존재하지 않는 리소스 (사용자, 카테고리, 파일)",
116120
content = @Content(
117121
mediaType = "application/json",
118122
examples = {
@@ -131,6 +135,14 @@ public interface PostControllerDocs {
131135
"message": "존재하지 않는 카테고리입니다.",
132136
"data": null
133137
}
138+
"""),
139+
@ExampleObject(name = "존재하지 않는 파일(이미지)", value = """
140+
{
141+
"success": false,
142+
"code": "FILE_004",
143+
"message": "파일 정보를 찾을 수 없습니다.",
144+
"data": null
145+
}
134146
""")
135147
}
136148
)
@@ -252,14 +264,22 @@ ResponseEntity<RsData<PageResponse<PostListResponse>>> getPosts(
252264
"message": "게시글이 조회되었습니다.",
253265
"data": {
254266
"postId": 101,
255-
"author": { "id": 5, "nickname": "홍길동", "profileImageUrl": null },
267+
"author": {
268+
"id": 5,
269+
"nickname": "홍길동",
270+
"profileImageUrl": null
271+
},
256272
"title": "첫 번째 게시글",
257273
"content": "안녕하세요, 첫 글입니다!",
258274
"thumbnailUrl": null,
259275
"categories": [
260276
{ "id": 1, "name": "공지사항" },
261277
{ "id": 2, "name": "자유게시판" }
262278
],
279+
"images": [
280+
{ "id": 11, "url": "https://example.com/image1.png" },
281+
{ "id": 12, "url": "https://example.com/image2.png" }
282+
],
263283
"likeCount": 10,
264284
"bookmarkCount": 2,
265285
"commentCount": 3,
@@ -337,8 +357,12 @@ ResponseEntity<RsData<PostDetailResponse>> getPost(
337357
{ "id": 1, "name": "공지사항" },
338358
{ "id": 2, "name": "자유게시판" }
339359
],
360+
"images": [
361+
{ "id": 11, "url": "https://example.com/image1.png" },
362+
{ "id": 12, "url": "https://example.com/image2.png" }
363+
],
340364
"createdAt": "2025-09-22T10:30:00",
341-
"updatedAt": "2025-09-22T10:30:00"
365+
"updatedAt": "2025-09-22T10:45:00"
342366
}
343367
}
344368
""")
@@ -409,7 +433,7 @@ ResponseEntity<RsData<PostDetailResponse>> getPost(
409433
),
410434
@ApiResponse(
411435
responseCode = "404",
412-
description = "존재하지 않는 사용자/게시글/카테고리",
436+
description = "존재하지 않는 리소스 (사용자, 게시글, 카테고리, 파일)",
413437
content = @Content(
414438
mediaType = "application/json",
415439
examples = {
@@ -436,6 +460,14 @@ ResponseEntity<RsData<PostDetailResponse>> getPost(
436460
"message": "존재하지 않는 카테고리입니다.",
437461
"data": null
438462
}
463+
"""),
464+
@ExampleObject(name = "존재하지 않는 파일(이미지)", value = """
465+
{
466+
"success": false,
467+
"code": "FILE_004",
468+
"message": "파일 정보를 찾을 수 없습니다.",
469+
"data": null
470+
}
439471
""")
440472
}
441473
)

0 commit comments

Comments
 (0)