Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 PR은 최근 포스트 목록 조회 API의 문서화를 개선하고 테스트 커버리지를 확장하는 데 중점을 둡니다. 기존에 누락되었던 Swagger 스펙을 보완하고, REST Docs를 활용한 컨트롤러 테스트를 추가하여 API 명세의 정확성과 최신성을 확보합니다. 이를 통해 개발자들이 해당 API를 더 쉽게 이해하고 활용할 수 있도록 돕습니다. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
최근 포스트 목록 조회 API에 대한 REST Docs 테스트를 추가하는 PR입니다. 전반적으로 좋은 변경이지만, 테스트 코드와 생성되는 문서를 개선하기 위한 몇 가지 제안 사항이 있습니다. 첫째, MockMvc 요청에서 GET 메서드에 대해서는 contentType 대신 accept를 사용하는 것이 올바릅니다. 둘째, REST Docs 테스트 데이터에 모든 포스트 타입(FREE, STORY, CURATION)을 포함하여 더 완전한 응답 필드 문서를 생성하는 것이 좋습니다. 자세한 내용은 각 리뷰 코멘트를 참고해주세요.
| PostResponseDto recentPost = new PostResponseDto( | ||
| 1L, | ||
| "최근 포스트 제목", | ||
| "최근 포스트 내용입니다", | ||
| List.of("#해시태그1"), | ||
| Instant.parse("2024-01-15T10:30:00Z"), | ||
| "작성자1", | ||
| 10, | ||
| 5, | ||
| "https://example.com/image1.jpg", | ||
| PostType.FREE, | ||
| null, | ||
| null, | ||
| null, | ||
| null | ||
| ); | ||
|
|
||
| PageResponseDto<PostResponseDto> response = new PageResponseDto<>( | ||
| List.of(recentPost), | ||
| null, | ||
| false | ||
| ); |
There was a problem hiding this comment.
현재 테스트는 FREE 타입의 포스트만 포함하고 있어, STORY나 CURATION 타입 포스트에만 존재하는 primaryComposer, additionalComposers 필드에 대한 문서가 불완전하게 생성됩니다. REST Docs 문서의 완성도를 높이기 위해, 다양한 포스트 타입을 포함하는 테스트 데이터를 생성하여 응답에 포함시키는 것을 권장합니다. 이렇게 하면 API 사용자가 각 포스트 타입에 따른 응답 구조를 더 명확하게 이해할 수 있습니다.
예를 들어, 다음과 같이 다양한 타입의 포스트를 생성할 수 있습니다:
// given
var composerSummary = new PostResponseDto.ComposerSummary(1L, "바흐", com.daramg.server.composer.domain.Era.BAROQUE, com.daramg.server.composer.domain.Continent.EUROPE);
var anotherComposer = new PostResponseDto.ComposerSummary(2L, "모차르트", com.daramg.server.composer.domain.Era.CLASSICAL, com.daramg.server.composer.domain.Continent.EUROPE);
PostResponseDto freePost = new PostResponseDto(
1L, "최근 포스트 제목 (FREE)", "자유 포스트 내용입니다.", List.of("#자유"),
Instant.parse("2024-01-15T10:30:00Z"), "작성자1", 10, 5,
"https://example.com/image1.jpg", PostType.FREE, null, null, true, false
);
PostResponseDto storyPost = new PostResponseDto(
2L, "최근 포스트 제목 (STORY)", "스토리 포스트 내용입니다.", List.of("#스토리", "#바흐"),
Instant.parse("2024-01-14T11:00:00Z"), "작성자2", 20, 8,
"https://example.com/image2.jpg", PostType.STORY, composerSummary, null, false, true
);
PostResponseDto curationPost = new PostResponseDto(
3L, "최근 포스트 제목 (CURATION)", "큐레이션 포스트 내용입니다.", List.of("#큐레이션", "#클래식"),
Instant.parse("2024-01-13T12:00:00Z"), "작성자3", 30, 15,
"https://example.com/image3.jpg", PostType.CURATION, composerSummary, List.of(anotherComposer), true, true
);
PageResponseDto<PostResponseDto> response = new PageResponseDto<>(
List.of(freePost, storyPost, curationPost),
"bmV4dEN1cnNvcg==", // Base64 encoded cursor
true
);이렇게 하면 primaryComposer, additionalComposers, nextCursor 필드가 포함된 응답 예시가 문서에 생성됩니다.
| // when | ||
| ResultActions result = mockMvc.perform(get("/posts/recent") | ||
| .param("size", "10") | ||
| .contentType(MediaType.APPLICATION_JSON) |
Summary
GET /posts/recentSwagger 스펙 누락 수정Test plan