Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: openweathermap api 요청 시 반환 dto 필드를 camel case로 수정 #207

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ public WeatherInfo getWeatherInfo(double longitude, double latitude) {

return new WeatherInfo(
mapWeatherType(info.weather()[0].id()),
info.main().feels_like(),
info.main().temp_min(),
info.main().temp_max(),
info.main().feelsLike(),
info.main().tempMin(),
info.main().tempMax(),
info.main().humidity(),
info.wind().speed());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
package com.dnd.runus.infrastructure.weather.openweathermap;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;

@JsonIgnoreProperties(ignoreUnknown = true)
public record OpenweathermapWeatherInfo(Weather[] weather, Main main, Wind wind) {
record Weather(int id, String main, String description, String icon) {}

record Main(double temp, double feels_like, double temp_min, double temp_max, double pressure, double humidity) {}
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
record Main(double temp, double feelsLike, double tempMin, double tempMax, double pressure, double humidity) {}

record Wind(double speed, double deg, double gust) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void getWeatherInfo() {
// then
assertNotNull(weatherInfo);
assertEquals(800, weatherInfo.weather()[0].id());
assertEquals(10.0, weatherInfo.main().feels_like());
assertEquals(10.0, weatherInfo.main().temp_min());
assertEquals(10.0, weatherInfo.main().feelsLike());
assertEquals(10.0, weatherInfo.main().tempMin());
}
}