feat: 날씨 응답에 상태 식별자와 Swagger 문서 추가#2281
Conversation
- 클라이언트가 날씨별 캐싱과 fallback 처리를 안정적으로 할 수 있도록 고정 ID를 응답에 포함 - 날씨 아이콘 선택 기준을 백엔드 enum에 함께 둬 문자열 비교에 의존하지 않도록 정리 - 기존 캐시에 날씨 문자열만 남아 있어도 신규 필드가 보정되도록 생성 경로를 유지
- Swagger에서 반환 가능한 날씨 문자열 7종을 바로 확인할 수 있도록 필드 설명과 allowable values를 보강 - weather_id와 날씨 상태의 매핑을 API 설명에 함께 적어 클라이언트 구현 기준을 명확히 함
📝 WalkthroughWalkthroughThis PR enriches the weather API with icon URLs and numeric identifiers by restructuring the ChangesWeather enrichment with icon URLs and enhanced schema documentation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (5)
src/main/java/in/koreatech/koin/domain/weather/controller/WeatherApi.javasrc/main/java/in/koreatech/koin/domain/weather/dto/WeatherResponse.javasrc/main/java/in/koreatech/koin/domain/weather/model/WeatherCondition.javasrc/test/java/in/koreatech/koin/acceptance/domain/WeatherApiTest.javasrc/test/java/in/koreatech/koin/unit/domain/weather/WeatherConditionTest.java
- 날씨 ID와 아이콘 URL 중 하나만 비어 있는 경우 서로 다른 날씨 기준의 값이 섞이지 않도록 같은 WeatherCondition에서 함께 보정 - 기존 캐시 호환성을 유지하면서 부분 보정 입력의 불일치 가능성을 차단 - 회귀 테스트로 weather 기준 보정값이 한 쌍으로 유지되는지 검증
🔍 개요
weather_id와weather_icon_url을 함께 내려줍니다.🚀 주요 변경 내용
/weather응답에weather_id,weather_icon_url필드를 추가하고, 기존 캐시 응답도 날씨 문자열 기준으로 신규 필드가 보정되도록 유지했습니다.맑음,구름많음,흐림,비,비/눈,눈,소나기반환 종류를 명시했습니다.💬 참고 사항
./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 (완료 조건)
Summary by CodeRabbit
New Features
Documentation
Tests