Skip to content

Commit

Permalink
[refactor/InhaBas#168]JSON Property Case 변경 (SNAKE_CASE -> LOWER_CAME…
Browse files Browse the repository at this point in the history
…L_CASE)
  • Loading branch information
skytin1004 committed Oct 31, 2023
1 parent 51ad935 commit 41693d1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@
@Configuration
public class WebConfig {

/**
* swagger-ui 에서 따로 snake_case 를 위한 설정을 제공하지 않음. camelCase 를 snake_case 로 변환하기 위한 resolver 등록
*/
@Bean
public ModelResolver modelResolver(ObjectMapper objectMapper) {
return new ModelResolver(objectMapper.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE));
return new ModelResolver(objectMapper.setPropertyNamingStrategy(PropertyNamingStrategies.LOWER_CAMEL_CASE));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class WebConfigTest {
@Autowired
private ModelResolver modelResolver;

@DisplayName("swagger 명세로 변환하는 modelResolver 는 snake_case 를 따른다.")
@DisplayName("swagger 명세로 변환하는 modelResolver 는 LOWER_CAMEL_CASE 를 따른다.")
@Test
public void ModelResolverSnakeCaseTest() {
//when
Expand All @@ -28,6 +28,6 @@ public void ModelResolverSnakeCaseTest() {

//then
Assertions.assertThat(propertyNamingStrategy)
.isEqualTo(PropertyNamingStrategies.SNAKE_CASE);
.isEqualTo(PropertyNamingStrategies.LOWER_CAMEL_CASE);
}
}

0 comments on commit 41693d1

Please # to comment.