Skip to content

[docs] 작곡가 생성 API Swagger 문서 추가#95

Merged
k3vin7 merged 1 commit intomainfrom
feat/createComposer-docs
Mar 3, 2026
Merged

[docs] 작곡가 생성 API Swagger 문서 추가#95
k3vin7 merged 1 commit intomainfrom
feat/createComposer-docs

Conversation

@k3vin7
Copy link
Contributor

@k3vin7 k3vin7 commented Mar 3, 2026

Summary

  • POST /composers REST Docs 테스트 추가
  • 테스트 실행 시 openapi3.yaml에 엔드포인트가 포함되어 Swagger에 노출됨

Cause

Swagger UI가 코드 자동 스캔이 아닌 정적 YAML(/docs/openapi3.yaml)을 사용하므로,
REST Docs 테스트가 없으면 Swagger에 노출되지 않음.

@gemini-code-assist
Copy link

Summary of Changes

Hello, 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은 POST /composers API 엔드포인트를 Swagger 문서에 통합하는 것을 목표로 합니다. 이는 Swagger UI가 코드 자동 스캔 대신 정적 openapi3.yaml 파일을 사용하기 때문에, REST Docs 테스트를 추가하여 해당 엔드포인트가 문서에 올바르게 포함되도록 보장합니다.

Highlights

  • Swagger 문서화: 새로운 작곡가 생성 API(POST /composers)에 대한 Swagger 문서가 추가되었습니다.
  • REST Docs 테스트: Swagger 문서 생성을 위해 POST /composers 엔드포인트에 대한 REST Docs 테스트가 구현되었습니다.
  • 정적 YAML 통합: Swagger UI가 정적 openapi3.yaml 파일을 사용하므로, REST Docs 테스트를 통해 해당 엔드포인트가 YAML 파일에 포함되도록 보장합니다.

🧠 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
  • src/test/java/com/daramg/server/composer/presentation/ComposerControllerTest.java
    • 필요한 JsonFieldTypeMap 클래스를 임포트했습니다.
    • 작곡가 생성 API(POST /composers)를 테스트하고 REST Docs를 생성하는 새로운 테스트 메서드 작곡가를_생성한다()를 추가했습니다.
    • 요청 필드 및 쿠키에 대한 상세한 문서화를 포함하여 REST Docs 스니펫을 구성했습니다.
Activity
  • k3vin7 님이 POST /composers API의 Swagger 문서화를 위해 새로운 REST Docs 테스트를 추가했습니다.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@k3vin7 k3vin7 merged commit c20f8b7 into main Mar 3, 2026
1 check passed
@k3vin7 k3vin7 deleted the feat/createComposer-docs branch March 3, 2026 10:30
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This PR aims to expose the composer creation API (POST /composers) in Swagger documentation by adding REST Docs tests. However, the underlying implementation of the composer creation logic contains a significant security flaw: the administrative check is hardcoded to a single user ID, leading to broken access control. It is recommended to replace this with a proper role-based authorization check. Additionally, while the changes generally align with the purpose, some improvements are suggested to increase test code maintainability and ensure API documentation completeness.

Comment on lines +33 to +43
Map<String, Object> requestBody = Map.of(
"koreanName", "베토벤",
"englishName", "Ludwig van Beethoven",
"gender", "MALE",
"nationality", "독일",
"birthYear", 1770,
"deathYear", 1827,
"bio", "독일의 작곡가",
"era", "CLASSICAL",
"continent", "EUROPE"
);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

테스트의 견고함과 유지보수성을 높이기 위해, Map<String, Object>을 사용하여 요청 본문을 생성하는 대신 ComposerCreateDto를 직접 사용하는 것이 좋습니다. 이렇게 하면 ComposerCreateDto의 필드명이 변경되거나 타입이 바뀔 경우 컴파일 시점에 오류를 발견할 수 있어 테스트가 깨지는 것을 방지할 수 있습니다. 제안된 코드를 적용한 후, IDE를 사용하여 import 문을 정리하는 것을 권장합니다.

Suggested change
Map<String, Object> requestBody = Map.of(
"koreanName", "베토벤",
"englishName", "Ludwig van Beethoven",
"gender", "MALE",
"nationality", "독일",
"birthYear", 1770,
"deathYear", 1827,
"bio", "독일의 작곡가",
"era", "CLASSICAL",
"continent", "EUROPE"
);
com.daramg.server.composer.dto.ComposerCreateDto requestBody = new com.daramg.server.composer.dto.ComposerCreateDto(
"베토벤",
"Ludwig van Beethoven",
null,
com.daramg.server.composer.domain.Gender.MALE,
"독일",
(short) 1770,
(short) 1827,
"독일의 작곡가",
com.daramg.server.composer.domain.Era.CLASSICAL,
com.daramg.server.composer.domain.Continent.EUROPE
);

Comment on lines +60 to +70
.requestFields(
fieldWithPath("koreanName").type(JsonFieldType.STRING).description("한국어 이름"),
fieldWithPath("englishName").type(JsonFieldType.STRING).description("영어 이름"),
fieldWithPath("gender").type(JsonFieldType.STRING).description("성별 (MALE / FEMALE / UNKNOWN)"),
fieldWithPath("nationality").type(JsonFieldType.STRING).description("국적").optional(),
fieldWithPath("birthYear").type(JsonFieldType.NUMBER).description("출생 연도").optional(),
fieldWithPath("deathYear").type(JsonFieldType.NUMBER).description("사망 연도").optional(),
fieldWithPath("bio").type(JsonFieldType.STRING).description("소개").optional(),
fieldWithPath("era").type(JsonFieldType.STRING).description("시대 (MEDIEVAL_RENAISSANCE / BAROQUE / CLASSICAL / ROMANTIC / MODERN_CONTEMPORARY)").optional(),
fieldWithPath("continent").type(JsonFieldType.STRING).description("대륙 (ASIA / NORTH_AMERICA / EUROPE / SOUTH_AMERICA / AFRICA_OCEANIA)").optional()
)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

ComposerCreateDtonativeName 필드가 존재하지만, API 문서에는 누락되어 있습니다. API 사용자가 모든 필드를 알 수 있도록 문서에 추가하는 것이 좋습니다.

Suggested change
.requestFields(
fieldWithPath("koreanName").type(JsonFieldType.STRING).description("한국어 이름"),
fieldWithPath("englishName").type(JsonFieldType.STRING).description("영어 이름"),
fieldWithPath("gender").type(JsonFieldType.STRING).description("성별 (MALE / FEMALE / UNKNOWN)"),
fieldWithPath("nationality").type(JsonFieldType.STRING).description("국적").optional(),
fieldWithPath("birthYear").type(JsonFieldType.NUMBER).description("출생 연도").optional(),
fieldWithPath("deathYear").type(JsonFieldType.NUMBER).description("사망 연도").optional(),
fieldWithPath("bio").type(JsonFieldType.STRING).description("소개").optional(),
fieldWithPath("era").type(JsonFieldType.STRING).description("시대 (MEDIEVAL_RENAISSANCE / BAROQUE / CLASSICAL / ROMANTIC / MODERN_CONTEMPORARY)").optional(),
fieldWithPath("continent").type(JsonFieldType.STRING).description("대륙 (ASIA / NORTH_AMERICA / EUROPE / SOUTH_AMERICA / AFRICA_OCEANIA)").optional()
)
.requestFields(
fieldWithPath("koreanName").type(JsonFieldType.STRING).description("한국어 이름"),
fieldWithPath("englishName").type(JsonFieldType.STRING).description("영어 이름"),
fieldWithPath("nativeName").type(JsonFieldType.STRING).description("현지어 이름").optional(),
fieldWithPath("gender").type(JsonFieldType.STRING).description("성별 (MALE / FEMALE / UNKNOWN)"),
fieldWithPath("nationality").type(JsonFieldType.STRING).description("국적").optional(),
fieldWithPath("birthYear").type(JsonFieldType.NUMBER).description("출생 연도").optional(),
fieldWithPath("deathYear").type(JsonFieldType.NUMBER).description("사망 연도").optional(),
fieldWithPath("bio").type(JsonFieldType.STRING).description("소개").optional(),
fieldWithPath("era").type(JsonFieldType.STRING).description("시대 (MEDIEVAL_RENAISSANCE / BAROQUE / CLASSICAL / ROMANTIC / MODERN_CONTEMPORARY)").optional(),
fieldWithPath("continent").type(JsonFieldType.STRING).description("대륙 (ASIA / NORTH_AMERICA / EUROPE / SOUTH_AMERICA / AFRICA_OCEANIA)").optional()
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant