Skip to content

Commit

Permalink
refactor : Docs에 Schema 업데이트
Browse files Browse the repository at this point in the history
  • Loading branch information
1000kkannoo committed Sep 9, 2023
1 parent ccfb2ff commit 73e99fd
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package dnd.project.docs.bookmark;

import com.epages.restdocs.apispec.ResourceSnippetParameters;
import com.epages.restdocs.apispec.Schema;
import dnd.project.docs.RestDocsSupport;
import dnd.project.domain.bookmark.controller.BookmarkController;
import dnd.project.domain.bookmark.response.BookmarkResponse;
Expand All @@ -14,6 +15,7 @@

import static com.epages.restdocs.apispec.MockMvcRestDocumentationWrapper.document;
import static com.epages.restdocs.apispec.ResourceDocumentation.resource;
import static com.epages.restdocs.apispec.Schema.*;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
Expand Down Expand Up @@ -66,6 +68,7 @@ void addBookmark() throws Exception {
.description("상태 코드"),
fieldWithPath("message").type(JsonFieldType.STRING)
.description("상태 메세지"))
.responseSchema(schema("Default"))
.build())));
}

Expand Down Expand Up @@ -98,6 +101,7 @@ void cancelBookmark() throws Exception {
.description("상태 코드"),
fieldWithPath("message").type(JsonFieldType.STRING)
.description("상태 메세지"))
.responseSchema(schema("Default"))
.build())));
}

Expand Down Expand Up @@ -178,6 +182,7 @@ void readMyBookmark() throws Exception {
.description("강의 가격"),
fieldWithPath("data[].addedDate").type(STRING)
.description("북마크 등록 날짜"))
.responseSchema(schema("BookmarkResponse_Detail"))
.build())));
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package dnd.project.docs.lecture;

import com.epages.restdocs.apispec.ResourceSnippetParameters;
import com.epages.restdocs.apispec.Schema;
import dnd.project.docs.RestDocsSupport;
import dnd.project.domain.lecture.controller.LectureController;
import dnd.project.domain.lecture.entity.Lecture;
Expand All @@ -24,6 +25,7 @@

import static com.epages.restdocs.apispec.MockMvcRestDocumentationWrapper.document;
import static com.epages.restdocs.apispec.ResourceDocumentation.resource;
import static com.epages.restdocs.apispec.Schema.*;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
Expand Down Expand Up @@ -142,6 +144,7 @@ void getLectures() throws Exception {
.description("강의 서브 카테고리"),
fieldWithPath("data.lectures[].imageUrl").type(JsonFieldType.STRING)
.description("강의 썸네일 URL"))
.responseSchema(schema("LectureListReadResponse"))
.build())));
}

Expand Down Expand Up @@ -236,6 +239,7 @@ void getLecture() throws Exception {
.description("강의 태그 이름"),
fieldWithPath("data.tagGroups[].tags[].count").type(JsonFieldType.NUMBER)
.description("강의 태그 개수"))
.responseSchema(schema("LectureReadResponse"))
.build())));
}

Expand Down Expand Up @@ -328,6 +332,7 @@ void getLectureReviews() throws Exception {
.description("후기 점수"),
fieldWithPath("data.reviews[].likeCount").type(JsonFieldType.NUMBER)
.description("후기 추천수"))
.responseSchema(schema("LectureReviewListReadResponse"))
.build())));
}

Expand Down Expand Up @@ -396,6 +401,7 @@ void getScopeReviewsScore() throws Exception {
.description("후기 태그"),
fieldWithPath("data[].source").type(STRING)
.description("강의 플랫폼"))
.responseSchema(schema("LectureScopeListReadResponse.DetailReview"))
.build())));
}

Expand Down Expand Up @@ -456,6 +462,7 @@ void getScopeLecturesBest() throws Exception {
.description("강사 이름"),
fieldWithPath("data[].url").type(STRING)
.description("강의 URL"))
.responseSchema(schema("LectureScopeListReadResponse.DetailLecture"))
.build())));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@


import com.epages.restdocs.apispec.ResourceSnippetParameters;
import com.epages.restdocs.apispec.Schema;
import dnd.project.docs.RestDocsSupport;
import dnd.project.domain.lecture.response.LectureScopeListReadResponse;
import dnd.project.domain.review.controller.ReviewController;
Expand All @@ -19,6 +20,7 @@

import static com.epages.restdocs.apispec.MockMvcRestDocumentationWrapper.document;
import static com.epages.restdocs.apispec.ResourceDocumentation.resource;
import static com.epages.restdocs.apispec.Schema.*;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.BDDMockito.given;
Expand Down Expand Up @@ -113,6 +115,8 @@ void createReview() throws Exception {
.description("후기 내용 / 없을시 빈 문자열"),
fieldWithPath("data.createdDate").type(STRING)
.description("후기 작성 날짜"))
.requestSchema(schema("ReviewRequest.Create"))
.responseSchema(schema("ReviewResponse.Create"))
.build())));
}

Expand Down Expand Up @@ -145,6 +149,7 @@ void deleteReview() throws Exception {
.description("상태 코드"),
fieldWithPath("message").type(JsonFieldType.STRING)
.description("상태 메세지"))
.responseSchema(schema("Default"))
.build())));
}

Expand Down Expand Up @@ -219,6 +224,8 @@ void updateReview() throws Exception {
.description("후기 내용 / 없을시 빈 문자열"),
fieldWithPath("data.createdDate").type(STRING)
.description("후기 작성 날짜"))
.requestSchema(schema("ReviewRequest.Create"))
.responseSchema(schema("ReviewResponse.Create"))
.build())));
}

Expand Down Expand Up @@ -266,6 +273,7 @@ void toggleLikeReview() throws Exception {
.description("유저 ID"),
fieldWithPath("data.isCancelled").type(BOOLEAN)
.description("좋아요 취소 여부 ex) 좋아요 등록시 -> false"))
.responseSchema(schema("ReviewResponse.ToggleLike"))
.build())));
}

Expand Down Expand Up @@ -331,6 +339,7 @@ void readRecentReview() throws Exception {
.description("유저 ID"),
fieldWithPath("data[].user.nickName").type(STRING)
.description("유저 닉네임"))
.responseSchema(schema("ReviewResponse.ReadDetails"))
.build())));
}

Expand Down Expand Up @@ -451,6 +460,7 @@ void readMyReviews() throws Exception {
.description("강사 이름"),
fieldWithPath("data[].lecture.imageUrl").type(STRING)
.description("강의 이미지 URL"))
.responseSchema(schema("ReviewResponse.ReadMyDetails"))
.build())));
}

Expand Down Expand Up @@ -521,6 +531,8 @@ void readKeywordReview() throws Exception {
.description("후기 태그"),
fieldWithPath("data[].source").type(STRING)
.description("강의 플랫폼"))
.requestSchema(schema("ReviewRequest.Keyword"))
.responseSchema(schema("LectureScopeListReadResponse.DetailReview"))
.build())));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package dnd.project.docs.user;

import com.epages.restdocs.apispec.ResourceSnippetParameters;
import com.epages.restdocs.apispec.Schema;
import dnd.project.docs.RestDocsSupport;
import dnd.project.domain.user.config.Platform;
import dnd.project.domain.user.controller.UserController;
Expand All @@ -15,6 +16,7 @@

import static com.epages.restdocs.apispec.MockMvcRestDocumentationWrapper.document;
import static com.epages.restdocs.apispec.ResourceDocumentation.resource;
import static com.epages.restdocs.apispec.Schema.*;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.BDDMockito.given;
Expand Down Expand Up @@ -94,6 +96,7 @@ void loginByKakao() throws Exception {
.description("발급된 JWT RefreshToken"))
.responseHeaders(
headerWithName("Set-Cookie").description("access_token, refresh_token"))
.responseSchema(schema("UserResponse.Login"))
.build())));
}

Expand Down Expand Up @@ -130,6 +133,8 @@ void addInterests() throws Exception {
.description("상태 코드"),
fieldWithPath("message").type(STRING)
.description("상태 메세지"))
.requestSchema(schema("UserRequest.Interests"))
.responseSchema(schema("Default"))
.build())));
}

Expand Down Expand Up @@ -177,6 +182,7 @@ void detailUser() throws Exception {
.description("유저 프로필 이미지 URL"),
fieldWithPath("data.interests").type(STRING)
.description("유저 관심분야"))
.responseSchema(schema("UserResponse.Detail"))
.build())));
}

Expand Down Expand Up @@ -235,6 +241,8 @@ void updateUser() throws Exception {
.description("유저 프로필 이미지 URL"),
fieldWithPath("data.interests").type(STRING)
.description("유저 관심분야"))
.requestSchema(schema("UserRequest.Update"))
.responseSchema(schema("UserResponse.Detail"))
.build())));
}
}

0 comments on commit 73e99fd

Please sign in to comment.