Skip to content

[Fix] xxxReviewListResponse의 non-null List 디코딩 문제를 해결합니다#485

Merged
HI-JIN2 merged 2 commits intodevelopfrom
fix/issue-json-parsing
Mar 3, 2026
Merged

[Fix] xxxReviewListResponse의 non-null List 디코딩 문제를 해결합니다#485
HI-JIN2 merged 2 commits intodevelopfrom
fix/issue-json-parsing

Conversation

@HI-JIN2
Copy link
Member

@HI-JIN2 HI-JIN2 commented Mar 3, 2026

Summary

백엔드 API 응답에서 imageUrls나 menuList 배열 내부에 null 값이 포함되어 내려왔을 때,
kotlinx.serialization이 non-null 리스트(List)로 디코딩하려고 시도하면서 발생한 문제

#467 kotlinx.serialization 변경으로 인한 파생 에러
3.3 고구마치즈돈까스 선택시 발생 (기타 더 있겠지만 재현 이걸로함)


 ApiResultCall - onFailure called
kotlinx.serialization.json.internal.JsonDecodingException: Unexpected JSON token at offset 464: Expected string literal but 'null' literal was found at path: $.result.dataList[1].imageUrls[0]
as-is to-be
앱이 꺼지진 않으나 일부 리뷰 리스트 파싱 안됨 파싱 잘됨
스크린샷 2026-03-03 오전 10 59 50 스크린샷 2026-03-03 오전 11 04 26

Describe your changes

다음 파일들의 리스트 속성을 nullable(List<String?>, List<MenuList?>)로 변경하고, 이를 도메인 모델로 변환할 때(예: toDomain()) filterNotNull() 연산자를 추가하여 null 값을 안전하게 무시하도록 처리했습니다

  1. MealReviewListResponse.kt
  2. MenuReviewListResponse.kt
  3. MyReviewListResponse.kt

Issue

To reviewers

잔존해있는 ArrayList를 List로 변경하고 디폴트 값도 lisfOf로 바꾸었습니다

@HI-JIN2 HI-JIN2 self-assigned this Mar 3, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 PR은 백엔드 API 응답에서 리스트 내부에 null 값이 포함될 때 발생하는 kotlinx.serialization 디코딩 오류를 해결합니다. 핵심적으로, 관련 데이터 클래스의 리스트 필드를 널러블 타입으로 조정하고, 도메인 모델 변환 과정에서 filterNotNull()을 적용하여 null 안전성을 확보했습니다. 또한, 컬렉션 초기화 방식을 listOf()로 통일하여 코드 일관성을 높였습니다.

Highlights

  • Kotlinx.serialization 오류 수정: 백엔드 API 응답에서 imageUrls 또는 menuList 배열 내부에 null 값이 포함될 경우 kotlinx.serialization이 non-null 리스트로 디코딩을 시도하여 발생하던 오류를 수정했습니다.
  • 널러블 타입 변경 및 안전한 처리: 문제 발생 필드(imageUrls, menuList)의 리스트 속성을 널러블(List<String?>, List<MenuList?>)로 변경하고, 도메인 모델로 변환 시 filterNotNull() 연산자를 추가하여 null 값을 안전하게 무시하도록 처리했습니다.
  • 컬렉션 초기화 방식 통일: 잔존해있던 ArrayList 사용을 List로 변경하고, 기본값 초기화를 arrayListOf() 대신 listOf()를 사용하도록 통일했습니다.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • app/src/main/java/com/eatssu/android/data/remote/dto/response/MealReviewListResponse.kt
    • dataList의 기본 초기화 방식을 arrayListOf()에서 listOf()로 변경했습니다.
    • DataList 내부의 menuList 타입을 List<MenuList>에서 List<MenuList?>로 변경하고 기본 초기화 방식을 arrayListOf()에서 listOf()로 변경했습니다.
    • DataList 내부의 imageUrls 타입을 List<String>에서 List<String?>로 변경하고 기본 초기화 방식을 arrayListOf()에서 listOf()로 변경했습니다.
    • toDomain() 확장 함수에서 menuListimageUrls를 처리할 때 filterNotNull()을 추가하여 널 안전성을 확보했습니다.
  • app/src/main/java/com/eatssu/android/data/remote/dto/response/MenuReviewListResponse.kt
    • dataList의 기본 초기화 방식을 arrayListOf()에서 listOf()로 변경했습니다.
    • DataList 내부의 imageUrls 타입을 List<String>에서 List<String?>로 변경하고 기본 초기화 방식을 arrayListOf()에서 listOf()로 변경했습니다.
    • toDomain() 확장 함수에서 imageUrls를 처리할 때 filterNotNull()을 추가하여 널 안전성을 확보했습니다.
  • app/src/main/java/com/eatssu/android/data/remote/dto/response/MyReviewListResponse.kt
    • dataList의 타입을 ArrayList<DataList>?에서 List<DataList>?로 변경하고 기본 초기화 방식을 arrayListOf()에서 listOf()로 변경했습니다.
    • DataList 내부의 imageUrls 타입을 ArrayList<String>에서 List<String?>로 변경하고 기본 초기화 방식을 arrayListOf()에서 listOf()로 변경했습니다.
    • DataList 내부의 menuList 타입을 ArrayList<MenuList>에서 List<MenuList?>로 변경하고 기본 초기화 방식을 arrayListOf()에서 listOf()로 변경했습니다.
    • toDomain() 확장 함수에서 menuListimageUrls를 처리할 때 filterNotNull()을 추가하여 널 안전성을 확보했습니다.
Activity
  • 작성자가 잔존해있던 ArrayListList로 변경하고 디폴트 값도 listOf()로 바꾸었다고 언급했습니다.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

이 PR은 백엔드 API 응답에 포함된 null 값으로 인해 발생하는 kotlinx.serialization 디코딩 오류를 수정합니다. imageUrlsmenuList의 리스트 요소 타입을 nullable로 변경하고, toDomain() 함수에서 filterNotNull()을 사용하여 null 값을 안전하게 처리하도록 수정한 것은 올바른 접근입니다. 또한 ArrayListList로 변경하여 코드 품질을 개선한 점도 좋습니다.

전반적으로 변경 사항은 정확하지만, 몇 가지 성능 개선 기회를 발견했습니다. filterNotNull().map() 이나 filterNotNull().firstOrNull() 대신 더 효율적인 코틀린 컬렉션 함수를 사용하는 것을 제안합니다. 자세한 내용은 각 파일의 주석을 확인해주세요.

@HI-JIN2 HI-JIN2 changed the title [Fix] MealReviewListResponse$DataList$$serializer.deserialize [Fix] xxxReviewListResponse의 non-null List 디코딩 문제를 해결합니다 Mar 3, 2026
filterNotNull().firstOrNull()은 리스트 전체를 순회하여 새로운 리스트를 만든 후 첫 번째 원소를 찾습니다. firstOrNull { it != null }을 사용하면 null이 아닌 첫 번째 원소를 찾는 즉시 순회를 멈추므로 더 효율적입니다.
@HI-JIN2 HI-JIN2 requested a review from PeraSite March 3, 2026 02:05
Copy link
Member

@PeraSite PeraSite left a comment

Choose a reason for hiding this comment

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

확실히 직렬화나 백엔드 처리를 바꾸는건 무섭네요.. 👍

@HI-JIN2
Copy link
Member Author

HI-JIN2 commented Mar 3, 2026

확실히 직렬화나 백엔드 처리를 바꾸는건 무섭네요.. 👍

그래서 저나 유리님이 적극적으로 kotlinx.serialization 바꾸려고 안했던 거긴해여 허허

@HI-JIN2 HI-JIN2 merged commit 448711b into develop Mar 3, 2026
2 checks passed
@HI-JIN2 HI-JIN2 deleted the fix/issue-json-parsing branch March 3, 2026 02:56
@PeraSite PeraSite mentioned this pull request Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants