diff --git a/src/test/java/dnd/project/docs/bookmark/BookmarkControllerDocsTest.java b/src/test/java/dnd/project/docs/bookmark/BookmarkControllerDocsTest.java index 1f5ba72..a19d68e 100644 --- a/src/test/java/dnd/project/docs/bookmark/BookmarkControllerDocsTest.java +++ b/src/test/java/dnd/project/docs/bookmark/BookmarkControllerDocsTest.java @@ -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; @@ -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; @@ -66,6 +68,7 @@ void addBookmark() throws Exception { .description("상태 코드"), fieldWithPath("message").type(JsonFieldType.STRING) .description("상태 메세지")) + .responseSchema(schema("Default")) .build()))); } @@ -98,6 +101,7 @@ void cancelBookmark() throws Exception { .description("상태 코드"), fieldWithPath("message").type(JsonFieldType.STRING) .description("상태 메세지")) + .responseSchema(schema("Default")) .build()))); } @@ -178,6 +182,7 @@ void readMyBookmark() throws Exception { .description("강의 가격"), fieldWithPath("data[].addedDate").type(STRING) .description("북마크 등록 날짜")) + .responseSchema(schema("BookmarkResponse_Detail")) .build()))); } } diff --git a/src/test/java/dnd/project/docs/lecture/LectureControllerDocsTest.java b/src/test/java/dnd/project/docs/lecture/LectureControllerDocsTest.java index a451a16..8691766 100644 --- a/src/test/java/dnd/project/docs/lecture/LectureControllerDocsTest.java +++ b/src/test/java/dnd/project/docs/lecture/LectureControllerDocsTest.java @@ -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; @@ -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; @@ -142,6 +144,7 @@ void getLectures() throws Exception { .description("강의 서브 카테고리"), fieldWithPath("data.lectures[].imageUrl").type(JsonFieldType.STRING) .description("강의 썸네일 URL")) + .responseSchema(schema("LectureListReadResponse")) .build()))); } @@ -236,6 +239,7 @@ void getLecture() throws Exception { .description("강의 태그 이름"), fieldWithPath("data.tagGroups[].tags[].count").type(JsonFieldType.NUMBER) .description("강의 태그 개수")) + .responseSchema(schema("LectureReadResponse")) .build()))); } @@ -328,6 +332,7 @@ void getLectureReviews() throws Exception { .description("후기 점수"), fieldWithPath("data.reviews[].likeCount").type(JsonFieldType.NUMBER) .description("후기 추천수")) + .responseSchema(schema("LectureReviewListReadResponse")) .build()))); } @@ -396,6 +401,7 @@ void getScopeReviewsScore() throws Exception { .description("후기 태그"), fieldWithPath("data[].source").type(STRING) .description("강의 플랫폼")) + .responseSchema(schema("LectureScopeListReadResponse.DetailReview")) .build()))); } @@ -456,6 +462,7 @@ void getScopeLecturesBest() throws Exception { .description("강사 이름"), fieldWithPath("data[].url").type(STRING) .description("강의 URL")) + .responseSchema(schema("LectureScopeListReadResponse.DetailLecture")) .build()))); } diff --git a/src/test/java/dnd/project/docs/review/ReviewControllerDocsTest.java b/src/test/java/dnd/project/docs/review/ReviewControllerDocsTest.java index fda2827..4cc266a 100644 --- a/src/test/java/dnd/project/docs/review/ReviewControllerDocsTest.java +++ b/src/test/java/dnd/project/docs/review/ReviewControllerDocsTest.java @@ -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; @@ -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; @@ -113,6 +115,8 @@ void createReview() throws Exception { .description("후기 내용 / 없을시 빈 문자열"), fieldWithPath("data.createdDate").type(STRING) .description("후기 작성 날짜")) + .requestSchema(schema("ReviewRequest.Create")) + .responseSchema(schema("ReviewResponse.Create")) .build()))); } @@ -145,6 +149,7 @@ void deleteReview() throws Exception { .description("상태 코드"), fieldWithPath("message").type(JsonFieldType.STRING) .description("상태 메세지")) + .responseSchema(schema("Default")) .build()))); } @@ -219,6 +224,8 @@ void updateReview() throws Exception { .description("후기 내용 / 없을시 빈 문자열"), fieldWithPath("data.createdDate").type(STRING) .description("후기 작성 날짜")) + .requestSchema(schema("ReviewRequest.Create")) + .responseSchema(schema("ReviewResponse.Create")) .build()))); } @@ -266,6 +273,7 @@ void toggleLikeReview() throws Exception { .description("유저 ID"), fieldWithPath("data.isCancelled").type(BOOLEAN) .description("좋아요 취소 여부 ex) 좋아요 등록시 -> false")) + .responseSchema(schema("ReviewResponse.ToggleLike")) .build()))); } @@ -331,6 +339,7 @@ void readRecentReview() throws Exception { .description("유저 ID"), fieldWithPath("data[].user.nickName").type(STRING) .description("유저 닉네임")) + .responseSchema(schema("ReviewResponse.ReadDetails")) .build()))); } @@ -451,6 +460,7 @@ void readMyReviews() throws Exception { .description("강사 이름"), fieldWithPath("data[].lecture.imageUrl").type(STRING) .description("강의 이미지 URL")) + .responseSchema(schema("ReviewResponse.ReadMyDetails")) .build()))); } @@ -521,6 +531,8 @@ void readKeywordReview() throws Exception { .description("후기 태그"), fieldWithPath("data[].source").type(STRING) .description("강의 플랫폼")) + .requestSchema(schema("ReviewRequest.Keyword")) + .responseSchema(schema("LectureScopeListReadResponse.DetailReview")) .build()))); } diff --git a/src/test/java/dnd/project/docs/user/UserControllerDocsTest.java b/src/test/java/dnd/project/docs/user/UserControllerDocsTest.java index 003733a..baf91bf 100644 --- a/src/test/java/dnd/project/docs/user/UserControllerDocsTest.java +++ b/src/test/java/dnd/project/docs/user/UserControllerDocsTest.java @@ -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; @@ -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; @@ -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()))); } @@ -130,6 +133,8 @@ void addInterests() throws Exception { .description("상태 코드"), fieldWithPath("message").type(STRING) .description("상태 메세지")) + .requestSchema(schema("UserRequest.Interests")) + .responseSchema(schema("Default")) .build()))); } @@ -177,6 +182,7 @@ void detailUser() throws Exception { .description("유저 프로필 이미지 URL"), fieldWithPath("data.interests").type(STRING) .description("유저 관심분야")) + .responseSchema(schema("UserResponse.Detail")) .build()))); } @@ -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()))); } }