Skip to content

Commit 2eb50c6

Browse files
authored
Merge: Commit swagger 수정 (#163)
Docs: Commit swagger 수정
2 parents 6b71322 + 39a5ca4 commit 2eb50c6

File tree

7 files changed

+211
-144
lines changed

7 files changed

+211
-144
lines changed

src/main/java/io/ejangs/docsa/domain/commit/swagger/CompareMergeCommitDocs.java

Lines changed: 61 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@
1818
@Target(ElementType.METHOD)
1919
@Retention(RetentionPolicy.RUNTIME)
2020
@Operation(
21-
summary = "머지할 2개의 커밋 내용을 조회합니다.",
21+
summary = "병합할 2개의 기록을 조회합니다.",
2222
description = """
23-
유저가 소유한 문서에서 머지할 2개의 커밋 내용을 조회합니다.
23+
유저가 소유한 문서에서 병합할 2개의 기록을 조회합니다.
2424
🔐 이 API는 세션 로그인 상태에서 호출되어야 하며,
2525
클라이언트는 쿠키(`JSESSIONID`)를 통해 인증 정보를 전송해야 합니다.
2626
""",
2727
parameters = {
2828
@Parameter(
29-
name = "documentId",
30-
description = "커밋들이 속한 문서 id",
29+
name = "docId",
30+
description = "기록들이 속한 문서 id",
3131
example = "1",
3232
required = true,
3333
in = ParameterIn.PATH
@@ -50,22 +50,51 @@
5050
responses = {
5151
@ApiResponse(
5252
responseCode = "200",
53-
description = "2개의 기록 (commit) 조회 성공 - content 2개 반환",
53+
description = "2개의 기록(commit) 조회 성공 - content 2개 반환",
5454
content = @Content(
5555
schema = @Schema(implementation = CompareMergeCommitResponse.class),
5656
mediaType = MediaType.APPLICATION_JSON_VALUE,
5757
examples = @ExampleObject(
5858
value = """
5959
{
6060
"base": {
61-
"id": "base123",
62-
"title": "기록A 제목",
63-
"content": "기록A 문서내용 ....."
61+
"id": "base123",
62+
"title": "기록A 제목",
63+
"content": [
64+
{
65+
"id": "mhTl6ghSkV",
66+
"type": "paragraph",
67+
"data": {
68+
"text": "Hey. Meet the new Editor. On this picture you can see it in action. Then, try a demo 🤓"
69+
}
70+
}
71+
]
6472
},
6573
"target": {
66-
"id": "target456",
67-
"title": "기록 B 제목",
68-
"content": "기록B 문서내용 ....."
74+
"id": "target456",
75+
"title": "기록 B 제목",
76+
"content": [
77+
{
78+
"id": "l98dyx3yjb",
79+
"type": "header",
80+
"data": {
81+
"text": "Key features",
82+
"level": 3
83+
}
84+
},
85+
{
86+
"id": "os_YI4eub4",
87+
"type": "list",
88+
"data": {
89+
"type": "unordered",
90+
"items": [
91+
"It is a block-style editor",
92+
"It returns clean data output in JSON",
93+
"Designed to be extendable and pluggable with a simple API"
94+
]
95+
}
96+
}
97+
]
6998
}
7099
}
71100
"""
@@ -91,7 +120,7 @@
91120
),
92121
@ApiResponse(
93122
responseCode = "404",
94-
description = "기록 (commit) 실패",
123+
description = "기록(commit) 실패 - 존재하지 않는 데이터",
95124
content = @Content(
96125
schema = @Schema(implementation = ErrorResponse.class),
97126
mediaType = MediaType.APPLICATION_JSON_VALUE,
@@ -119,6 +148,26 @@
119148
}
120149
)
121150
),
151+
@ApiResponse(
152+
responseCode = "500",
153+
description = "기록 조회 실패 - MySQL 또는 MongoDB 데이터 처리 실패",
154+
content = @Content(
155+
schema = @Schema(implementation = ErrorResponse.class),
156+
mediaType = MediaType.APPLICATION_JSON_VALUE,
157+
examples = {
158+
@ExampleObject(
159+
name = "MySQL 또는 MongoDB 데이터 처리 실패",
160+
value = """
161+
{
162+
"status": 500,
163+
"message": "데이터 처리 중 오류가 발생했습니다. 잠시 후 다시 시도해주세요.",
164+
"error": "DATABASE_ERROR"
165+
}
166+
"""
167+
)
168+
}
169+
)
170+
)
122171
}
123172
)
124173
public @interface CompareMergeCommitDocs {

src/main/java/io/ejangs/docsa/domain/commit/swagger/CreateCommitDocs.java

Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
""",
2929
parameters = {
3030
@Parameter(
31-
name = "documentId",
31+
name = "docId",
3232
description = "기록하려는 문서의 id",
3333
example = "1",
3434
required = true,
@@ -42,36 +42,36 @@
4242
examples = @ExampleObject(
4343
value = """
4444
{
45-
"title": "문서 초안 작성 완료",
46-
"description": "1차 초안 커밋입니다.",
47-
"branchId": 1,
48-
"blocks": [
49-
{
50-
"id": "mhTl6ghSkV",
51-
"type": "paragraph",
52-
"data": {
53-
"text": "Hey. Meet the new Editor. On this picture you can see it in action. Then, try a demo 🤓"
54-
}
55-
},
56-
{
57-
"id": "os_YI4eub4",
58-
"type": "list",
59-
"data": {
60-
"type": "unordered",
61-
"items": [
62-
"It is a block-style editor",
63-
"It returns clean data output in JSON",
64-
"Designed to be extendable and pluggable with a <a href=\\"https://editorjs.io/creating-a-block-tool\\">simple API</a>"
65-
]
66-
}
67-
}
68-
],
69-
"blockOrders": [
70-
"mhTl6ghSkV",
71-
"l98dyx3yjb",
72-
"os_YI4eub4"
73-
]
74-
}
45+
"title": "문서 초안 작성 완료",
46+
"description": "1차 초안 커밋입니다.",
47+
"branchId": 1,
48+
"blocks": [
49+
{
50+
"id": "mhTl6ghSkV",
51+
"type": "paragraph",
52+
"data": {
53+
"text": "Hey. Meet the new Editor. On this picture you can see it in action. Then, try a demo 🤓"
54+
}
55+
},
56+
{
57+
"id": "os_YI4eub4",
58+
"type": "list",
59+
"data": {
60+
"type": "unordered",
61+
"items": [
62+
"It is a block-style editor",
63+
"It returns clean data output in JSON",
64+
"Designed to be extendable and pluggable with a <a href=\\"https://editorjs.io/creating-a-block-tool\\">simple API</a>"
65+
]
66+
}
67+
}
68+
],
69+
"blockOrders": [
70+
"mhTl6ghSkV",
71+
"l98dyx3yjb",
72+
"os_YI4eub4"
73+
]
74+
}
7575
"""
7676
)
7777
)
@@ -129,16 +129,6 @@
129129
}
130130
"""
131131
),
132-
@ExampleObject(
133-
name = "문단의 순서를 찾을 수 없습니다.",
134-
value = """
135-
{
136-
"status": 400,
137-
"message": "문단의 순서를 찾을 수 없습니다.",
138-
"error": "BLOCK_SEQUENCE_NOT_FOUND"
139-
}
140-
"""
141-
),
142132
@ExampleObject(
143133
name = "문단의 순서가 유효하지 않은 경우",
144134
value = """
@@ -176,12 +166,32 @@
176166
schema = @Schema(implementation = ErrorResponse.class),
177167
mediaType = MediaType.APPLICATION_JSON_VALUE,
178168
examples = {
169+
@ExampleObject(
170+
name = "해당 문서에 속한 브랜치가 아닐 경우",
171+
value = """
172+
{
173+
"status": 404,
174+
"message": "해당 버전을 찾을 수 없습니다.",
175+
"error": "BRANCH_NOT_FOUND_OR_FORBIDDEN"
176+
}
177+
"""
178+
),
179+
@ExampleObject(
180+
name = "문단의 순서를 찾을 수 없습니다.",
181+
value = """
182+
{
183+
"status": 404,
184+
"message": "문단의 순서를 찾을 수 없습니다.",
185+
"error": "BLOCK_SEQUENCE_NOT_FOUND"
186+
}
187+
"""
188+
),
179189
@ExampleObject(
180190
name = "존재하지 않는 브랜치",
181191
value = """
182192
{
183193
"status": 404,
184-
"message": "해당 브랜치를 찾을 수 없습니다.",
194+
"message": "해당 버전을 찾을 수 없습니다.",
185195
"error": "BRANCH_NOT_FOUND"
186196
}
187197
"""
@@ -201,29 +211,19 @@
201211
),
202212
@ApiResponse(
203213
responseCode = "500",
204-
description = "기록 생성 실패 - MySQL 또는 MongoDB 저장 실패",
214+
description = "기록 생성 실패 - MySQL 또는 MongoDB 데이터 처리 실패",
205215
content = @Content(
206216
schema = @Schema(implementation = ErrorResponse.class),
207217
mediaType = MediaType.APPLICATION_JSON_VALUE,
208218
examples = {
209219
@ExampleObject(
210-
name = "MySQL 저장 실패",
220+
name = "MySQL 또는 MongoDB 데이터 처리 실패",
211221
value = """
212-
{
213-
"status": 500,
214-
"message": "서버 오류로 인해 기록 생성에 실패했습니다.",
215-
"error": "FAIL_CREATE_COMMIT"
216-
}
217-
"""
218-
),
219-
@ExampleObject(
220-
name = "MongoDB 저장 실패",
221-
value = """
222-
{
223-
"status": 500,
224-
"message": "MongoDB 저장에 문제가 생겼습니다.",
225-
"error": "FAIL_SAVE_MONGODB"
226-
}
222+
{
223+
"status": 500,
224+
"message": "데이터 처리 중 오류가 발생했습니다. 잠시 후 다시 시도해주세요.",
225+
"error": "DATABASE_ERROR"
226+
}
227227
"""
228228
)
229229
}

0 commit comments

Comments
 (0)