반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- FirebaseAnalytics
- Git commit 합치기
- gitsquash
- 헤드퍼스트전략패턴
- cypress React
- 디자인패턴
- 리팩토링2판4장
- 시스템설계면접
- cypressBDD
- 시스템설계면접예시
- formik react-query submitting not working
- 시스템설계
- react-ga
- 리액트구글애널리틱스
- 가상면접2장
- react
- s3이미지다운로드됨
- 리팩터링2판테스트
- git commit merge
- 시스템설계면접팁
- formik submitting not working
- 전략패턴
- 가상면접3장
- 테스트코드책
- file not found Error
- awss3
- git squash
- 시스템설계방법
- git commit 협업
- 가상면접으로대규모시스템
Archives
- Today
- Total
mingg IT
[kotlin + swagger-ui] java.lang.NumberFormatException: For input string: "" 에러 해결 본문
BackEnd
[kotlin + swagger-ui] java.lang.NumberFormatException: For input string: "" 에러 해결
mingg123 2023. 10. 22. 22:26현상
- http://localhost:8080/swagger-ui/index.html# 에 접속하면 NumberFormatException 에러를 뱉었다. (평소엔 괜찮았음)
원인
- 평소엔 이상이 없었는데 최근부터 발생해서 최근 커밋 내용을 뒤져보았다.
- 추가한 부분은 Swagger-ui에 @ApiOperation, @ApiImplicitParam을 추가했었다.
- 원인은 @ApiImplicitParam 에서 숫자타입을 사용시 'example'를 작성해주지 않아서 이다.
@GetMapping("/detail")
@ApiOperation(value = "상품 상세 정보", notes = "상품 상세 정보를 반환 합니다")
@ApiImplicitParam(name = "id", value = "조회할 상품 ID", required = true)
fun getProduct(@RequestParam("id") id: Long): ResponseEntity<ProductDetailDTO> {
return ResponseEntity.ok(productService.getProductDetail(id))
}
해결
- @ApiImplicitParam 사용시 example 을 추가해주었다. (아래와 같이 작성)
@GetMapping("/detail")
@ApiOperation(value = "상품 상세 정보", notes = "상품 상세 정보를 반환 합니다")
@ApiImplicitParam(name = "id", value = "조회할 상품 ID", required = true, example="1")
fun getProduct(@RequestParam("id") id: Long): ResponseEntity<ProductDetailDTO> {
return ResponseEntity.ok(productService.getProductDetail(id))
}
swagger-ui 사용시에도 에러가 발생하지 않았다!
몰랐던 부분을 알게되었다. 굳
'BackEnd' 카테고리의 다른 글
Comments