Skip to content

feat: 날씨 응답에 상태 식별자와 Swagger 문서 추가#2281

Open
dh2906 wants to merge 4 commits into
developfrom
feat/weather-condition-swagger
Open

feat: 날씨 응답에 상태 식별자와 Swagger 문서 추가#2281
dh2906 wants to merge 4 commits into
developfrom
feat/weather-condition-swagger

Conversation

@dh2906
Copy link
Copy Markdown
Contributor

@dh2906 dh2906 commented May 28, 2026

🔍 개요

  • 날씨 조회 응답에서 클라이언트가 날씨 상태를 안정적으로 구분할 수 있도록 weather_idweather_icon_url을 함께 내려줍니다.
  • Swagger에서 반환 가능한 날씨 7종과 ID 매핑을 바로 확인할 수 있도록 문서 설명을 보강했습니다.
  • close 없음

🚀 주요 변경 내용

  • 날씨 상태 enum에 고정 ID와 아이콘 URL을 추가했습니다.
  • /weather 응답에 weather_id, weather_icon_url 필드를 추가하고, 기존 캐시 응답도 날씨 문자열 기준으로 신규 필드가 보정되도록 유지했습니다.
  • Swagger 응답 필드와 API 설명에 맑음, 구름많음, 흐림, , 비/눈, , 소나기 반환 종류를 명시했습니다.
  • 날씨 응답 스펙 변경을 인수 테스트와 enum 단위 테스트에 반영했습니다.

💬 참고 사항

  • 아이콘 경로는 아직 이미지 파일을 받은게 없어서 임의로 정했습니다. 아이콘 받으면 병합하겠습니당
  • ./gradlew test --tests 'in.koreatech.koin.unit.domain.weather.*' --tests 'in.koreatech.koin.acceptance.domain.WeatherApiTest' --no-daemon으로 날씨 도메인 테스트를 확인했습니다.
  • ./gradlew compileJava --no-daemon으로 Swagger annotation 변경 후 컴파일을 확인했습니다.

✅ Checklist (완료 조건)

  • 코드 스타일 가이드 준수
  • 테스트 코드 포함됨
  • Reviewers / Assignees / Labels 지정 완료
  • 보안 및 민감 정보 검증 (API 키, 환경 변수, 개인정보 등)

Compound Engineering
Codex

Summary by CodeRabbit

  • New Features

    • Weather API now returns additional fields: weather ID and weather icon URL alongside temperature and weather type.
  • Documentation

    • Enhanced weather endpoint documentation with detailed descriptions and enumeration of all 7 supported weather types.
  • Tests

    • Updated test coverage to validate new response fields and weather condition attributes.

Review Change Stack

dh2906 added 2 commits May 28, 2026 22:22
- 클라이언트가 날씨별 캐싱과 fallback 처리를 안정적으로 할 수 있도록 고정 ID를 응답에 포함
- 날씨 아이콘 선택 기준을 백엔드 enum에 함께 둬 문자열 비교에 의존하지 않도록 정리
- 기존 캐시에 날씨 문자열만 남아 있어도 신규 필드가 보정되도록 생성 경로를 유지
- Swagger에서 반환 가능한 날씨 문자열 7종을 바로 확인할 수 있도록 필드 설명과 allowable values를 보강
- weather_id와 날씨 상태의 매핑을 API 설명에 함께 적어 클라이언트 구현 기준을 명확히 함
@github-actions github-actions Bot requested review from JanooGwan and taejinn May 28, 2026 13:25
@dh2906 dh2906 added the 문서 문서화와 관련된 이슈입니다. label May 28, 2026
@github-actions github-actions Bot requested review from ImTotem and Soundbar91 May 28, 2026 13:26
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 28, 2026

Unit Test Results

671 tests   668 ✔️  1m 16s ⏱️
168 suites      3 💤
168 files        0

Results for commit 0928cdf.

♻️ This comment has been updated with latest results.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

📝 Walkthrough

Walkthrough

This PR enriches the weather API with icon URLs and numeric identifiers by restructuring the WeatherCondition enum to carry ID and icon URL fields, updating WeatherResponse to expose these derived values in responses, and enhancing API documentation and test assertions to reflect the expanded schema.

Changes

Weather enrichment with icon URLs and enhanced schema documentation

Layer / File(s) Summary
WeatherCondition enum model restructuring
src/main/java/in/koreatech/koin/domain/weather/model/WeatherCondition.java, src/test/java/in/koreatech/koin/unit/domain/weather/WeatherConditionTest.java
Enum constants now include numeric ID and icon URL alongside localized value. Constructor changes from (String value) to (Integer id, String value, String iconUrl). Lookup maps are consolidated into a single CONDITIONS_BY_VALUE map. Old from(sky, precipitationType) factory method is removed and replaced with fromValue(String value) that returns the matching condition or null. Unit test validates 7 enum values and SUNNY's ID and icon URL.
WeatherResponse record with derived fields
src/main/java/in/koreatech/koin/domain/weather/dto/WeatherResponse.java
Record adds weatherId and weatherIconUrl components with enriched @Schema annotations. New convenience constructor WeatherResponse(Integer, String) delegates to canonical constructor with nulls. Canonical constructor derives missing ID and icon URL from WeatherCondition.fromValue(weather) when those fields are null. Factory method of() now passes enum ID and icon URL.
API endpoint documentation
src/main/java/in/koreatech/koin/domain/weather/controller/WeatherApi.java
getWeather() @Operation annotation expanded to include detailed description enumerating all 7 weather types and their meanings in a Java text block.
Test response validation
src/test/java/in/koreatech/koin/acceptance/domain/WeatherApiTest.java
Acceptance test assertion extended to validate weather_id and weather_icon_url fields in the /weather response JSON.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • BCSDLab/KOIN_API_V2#2276: Overlapping weather endpoint/DTO/enum changes that form the foundational context for this PR's enhancements.

Suggested labels

기능

Suggested reviewers

  • DHkimgit
  • ImTotem
  • BaeJinho4028

Poem

🐰 A rabbit hops through weather codes,
Icons dancing down the roads,
IDs bright and URLs clean,
The finest forecast ever seen!
⛅🌤️

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main changes: adding weather status identifiers (weather_id), icon URLs (weather_icon_url), and enhanced Swagger documentation to the weather API response.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/weather-condition-swagger

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/main/java/in/koreatech/koin/domain/weather/dto/WeatherResponse.java`:
- Around line 44-50: The constructor logic in WeatherResponse currently assigns
weatherId and weatherIconUrl independently which can yield mismatched pairs;
update the WeatherResponse constructor to call
WeatherCondition.fromValue(weather) once into a local variable (e.g.,
weatherCondition) and if either weatherId or weatherIconUrl is null assign both
values from weatherCondition (weatherCondition.getId() and
weatherCondition.getIconUrl()), leaving existing non-null values intact; ensure
you only perform this paired assignment when weatherCondition is non-null.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 44392a7a-97b0-4364-9773-e94952168ec7

📥 Commits

Reviewing files that changed from the base of the PR and between a5ba8b1 and f687448.

📒 Files selected for processing (5)
  • src/main/java/in/koreatech/koin/domain/weather/controller/WeatherApi.java
  • src/main/java/in/koreatech/koin/domain/weather/dto/WeatherResponse.java
  • src/main/java/in/koreatech/koin/domain/weather/model/WeatherCondition.java
  • src/test/java/in/koreatech/koin/acceptance/domain/WeatherApiTest.java
  • src/test/java/in/koreatech/koin/unit/domain/weather/WeatherConditionTest.java

dh2906 and others added 2 commits May 28, 2026 22:37
- 날씨 ID와 아이콘 URL 중 하나만 비어 있는 경우 서로 다른 날씨 기준의 값이 섞이지 않도록 같은 WeatherCondition에서 함께 보정
- 기존 캐시 호환성을 유지하면서 부분 보정 입력의 불일치 가능성을 차단
- 회귀 테스트로 weather 기준 보정값이 한 쌍으로 유지되는지 검증
Copy link
Copy Markdown

@JanooGwan JanooGwan left a comment

Choose a reason for hiding this comment

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

👍👍👍

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

Labels

문서 문서화와 관련된 이슈입니다.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants