Migrate app settings response to the generated GetApplicationResponse model - #6615
Conversation
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
SDK Size Comparison 📏
|
WalkthroughThe configuration API now returns ChangesApplication response model migration
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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.
🧹 Nitpick comments (4)
stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/MoshiChatApiTest.kt (1)
236-236: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRename the test to a backtick-delimited name.
The changed method still uses
testAppSettings. Rename it to a readable backtick test name.
As per coding guidelines, test methods in**/*Test.{kt,java}must use backtick names.🤖 Prompt for 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. In `@stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/MoshiChatApiTest.kt` at line 236, Rename the test method testAppSettings to a descriptive backtick-delimited Kotlin test name, preserving its existing parameters, runTest body, and behavior.Source: Coding guidelines
stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/mapping/DomainMappingTest.kt (1)
329-348: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCover the non-positive size-limit branch with explicit inputs.
randomAppSettingsResponse()supplies positive limits, so this test never enterssizeLimit <= 0. The expected value also repeats the production expression. Add explicit0and negative cases for both upload configurations and assertAppSettings.DEFAULT_SIZE_LIMIT_IN_BYTESdirectly.
As per coding guidelines, changed behavior must have refreshed tests.🤖 Prompt for 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. In `@stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/mapping/DomainMappingTest.kt` around lines 329 - 348, Update the `GetApplicationResponse is correctly mapped to AppSettings` test to use explicit zero and negative `sizeLimit` inputs for both `fileUploadConfig` and `imageUploadConfig`, rather than relying on `randomAppSettingsResponse()`. Assert `AppSettings.DEFAULT_SIZE_LIMIT_IN_BYTES` directly for each non-positive limit, while retaining coverage of normal positive-limit mapping.Source: Coding guidelines
stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/MoshiChatApiTestArguments.kt (1)
107-107: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winExercise JSON deserialization for the new response model.
appSettingsInput()supplies a prebuiltGetApplicationResponsetoRetroSuccess. This verifies the typed endpoint path, but it cannot detect an incorrect@Jsonname or generated adapter issue forfile_upload_config,image_upload_config, orsize_limit. Add a raw JSON case through the parser, or reference an existing wire-level test that covers these fields.
As per coding guidelines, changed behavior must have refreshed tests.🤖 Prompt for 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. In `@stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/MoshiChatApiTestArguments.kt` at line 107, Update appSettingsInput() and its parameterized cases to include a raw JSON response parsed through the Moshi/API parser, covering file_upload_config, image_upload_config, and size_limit, rather than only supplying a prebuilt GetApplicationResponse; alternatively reference an existing wire-level test that validates these fields and refresh the changed-behavior coverage.Source: Coding guidelines
stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/AppResponseFields.kt (1)
17-22: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDocument the generated-file suppression policy.
The three generated models add the same undocumented file-level suppression block. Add a generator-level rationale or configure a generated-source exemption. Remove the unused
kotlin.collections.Listimport inFileUploadConfig.ktif the generator does not require it.
stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/AppResponseFields.kt#L17-L22: document or remove the file-level suppressions.stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/FileUploadConfig.kt#L17-L22: document or remove the file-level suppressions and remove the unusedListimport if possible.stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/GetApplicationResponse.kt#L17-L22: document or remove the file-level suppressions.
As per coding guidelines, suppressions must be documented.🤖 Prompt for 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. In `@stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/AppResponseFields.kt` around lines 17 - 22, The generated model suppression blocks are undocumented and should be addressed consistently across AppResponseFields.kt:17-22, FileUploadConfig.kt:17-22, and GetApplicationResponse.kt:17-22 by documenting their generator-level rationale or configuring an exemption and removing unnecessary suppressions. In FileUploadConfig.kt:17-22, also remove the unused kotlin.collections.List import if it is not required by generation.Source: Coding guidelines
🤖 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.
Nitpick comments:
In
`@stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/AppResponseFields.kt`:
- Around line 17-22: The generated model suppression blocks are undocumented and
should be addressed consistently across AppResponseFields.kt:17-22,
FileUploadConfig.kt:17-22, and GetApplicationResponse.kt:17-22 by documenting
their generator-level rationale or configuring an exemption and removing
unnecessary suppressions. In FileUploadConfig.kt:17-22, also remove the unused
kotlin.collections.List import if it is not required by generation.
In
`@stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/mapping/DomainMappingTest.kt`:
- Around line 329-348: Update the `GetApplicationResponse is correctly mapped to
AppSettings` test to use explicit zero and negative `sizeLimit` inputs for both
`fileUploadConfig` and `imageUploadConfig`, rather than relying on
`randomAppSettingsResponse()`. Assert `AppSettings.DEFAULT_SIZE_LIMIT_IN_BYTES`
directly for each non-positive limit, while retaining coverage of normal
positive-limit mapping.
In
`@stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/MoshiChatApiTest.kt`:
- Line 236: Rename the test method testAppSettings to a descriptive
backtick-delimited Kotlin test name, preserving its existing parameters, runTest
body, and behavior.
In
`@stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/MoshiChatApiTestArguments.kt`:
- Line 107: Update appSettingsInput() and its parameterized cases to include a
raw JSON response parsed through the Moshi/API parser, covering
file_upload_config, image_upload_config, and size_limit, rather than only
supplying a prebuilt GetApplicationResponse; alternatively reference an existing
wire-level test that validates these fields and refresh the changed-behavior
coverage.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 59f8c11f-4019-4191-acca-1c74548e9e99
📒 Files selected for processing (10)
stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/endpoint/ConfigApi.ktstream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/mapping/DomainMapping.ktstream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/response/AppSettingsResponse.ktstream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/AppResponseFields.ktstream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/FileUploadConfig.ktstream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/GetApplicationResponse.ktstream-chat-android-client/src/test/java/io/getstream/chat/android/client/Mother.ktstream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/MoshiChatApiTest.ktstream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/MoshiChatApiTestArguments.ktstream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/mapping/DomainMappingTest.kt
💤 Files with no reviewable changes (1)
- stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/response/AppSettingsResponse.kt
|
|
🚀 Available in v7.8.0 |



Goal
Migrate the app-settings response (
getAppSettings/ChatClient.appSettings()) from the hand-writtenAppSettingsResponseto the generatedGetApplicationResponsenetwork model.Part of AND-1291
Implementation
GetApplicationResponse,AppResponseFields, andFileUploadConfig; remove the hand-writtenAppSettingsResponse.ConfigApi.getAppSettings()toGetApplicationResponseand map it to the domainAppSettingsinDomainMapping.Testing
DomainMappingTestcovers theGetApplicationResponse->AppSettingsmapping (upload configs, size limits).appSettings()on the wire: parses cleanly, fields populated (name, allowed/blocked extensions, size limits).spotlessApply,apiDump(no public-API change),detekt, and the full clienttestDebugUnitTestsuite pass.Summary by CodeRabbit
Bug Fixes
Tests