Migrate poll write request bodies to generated models - #6607
Conversation
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
SDK Size Comparison 📏
|
…atePollRequest, and option models
8a3d46f to
f5fb3b4
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughPoll creation, update, and option requests now use network DTOs. Moshi adapters serialize flattened custom data and voting visibility values. API mappings reject poll updates without option IDs. ChangesPoll DTO migration
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/CreatePollOptionRequest.kt (1)
17-22: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDocument or remove the file suppressions.
These blanket suppressions disable diagnostics in every new DTO without an explanation. Remove entries that generated code does not require. If the generator requires an entry, document that reason next to the suppression.
stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/CreatePollOptionRequest.kt#L17-L22: Narrow or document the suppressions.stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/CreatePollRequest.kt#L17-L22: Narrow or document the suppressions.stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/PollOptionInput.kt#L17-L22: Narrow or document the suppressions.stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/PollOptionRequest.kt#L17-L22: Narrow or document the suppressions.stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/UpdatePollOptionRequest.kt#L17-L22: Narrow or document the suppressions.stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/UpdatePollRequest.kt#L17-L22: Narrow or document the suppressions.As per coding guidelines, “avoid suppressions unless 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/CreatePollOptionRequest.kt` around lines 17 - 22, Remove unnecessary entries from the file-level suppression block in each DTO, retaining only suppressions required by the generated models. For any retained suppression, add a concise adjacent comment documenting the generator requirement. Apply this to CreatePollOptionRequest.kt, CreatePollRequest.kt, PollOptionInput.kt, PollOptionRequest.kt, UpdatePollOptionRequest.kt, and UpdatePollRequest.kt at the listed suppression blocks.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.
Inline comments:
In
`@stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/MoshiChatApi.kt`:
- Around line 1837-1844: Remove the id.orEmpty() fallback in updatePollOption
and the option mapping within updatePoll; require option.id/it.id to be present
and fail fast when it is null before constructing UpdatePollOptionRequest or the
update payload. Preserve the existing mapping for valid IDs while ensuring
missing IDs are not sent as empty strings.
---
Nitpick comments:
In
`@stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/CreatePollOptionRequest.kt`:
- Around line 17-22: Remove unnecessary entries from the file-level suppression
block in each DTO, retaining only suppressions required by the generated models.
For any retained suppression, add a concise adjacent comment documenting the
generator requirement. Apply this to CreatePollOptionRequest.kt,
CreatePollRequest.kt, PollOptionInput.kt, PollOptionRequest.kt,
UpdatePollOptionRequest.kt, and UpdatePollRequest.kt at the listed suppression
blocks.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 0d82c020-9b3a-4052-9f6e-48fcb88f162a
📒 Files selected for processing (15)
stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/MoshiChatApi.ktstream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/endpoint/PollsApi.ktstream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/requests/PollRequests.ktstream-chat-android-client/src/main/java/io/getstream/chat/android/client/parser2/MoshiChatParser.ktstream-chat-android-client/src/main/java/io/getstream/chat/android/client/parser2/adapters/PollDtoAdapters.ktstream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/CreatePollOptionRequest.ktstream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/CreatePollRequest.ktstream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/PollOptionInput.ktstream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/PollOptionRequest.ktstream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/UpdatePollOptionRequest.ktstream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/UpdatePollRequest.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/parser2/PollOptionInputAdapterTest.ktstream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/PollWriteRequestAdapterTest.ktstream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/testdata/PollDtoTestData.kt
💤 Files with no reviewable changes (1)
- stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/requests/PollRequests.kt
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
|
🚀 Available in v7.8.0 |


Goal
Migrate the poll write request bodies (
createPoll,updatePoll,createPollOption,updatePollOption) to the generatedCreatePollRequest,UpdatePollRequest,CreatePollOptionRequest,UpdatePollOptionRequest,PollOptionInput, andPollOptionRequestnetwork models. Unblocked by the CHA-4436 backend fix that tags the poll requestcustomfield.Part of AND-1291
Implementation
internalpoll write-request models; remove the hand-writtenCreatePollRequest/UpdatePollRequest/UpstreamOptionDto.custom(extraData) flattened to the JSON root via aCustomObjectDtoAdapter(extraDataPropertyName = "custom")registered inMoshiChatParser;votingVisibilityuses the generated sealed class + its adapter.MoshiChatApimappers andPollsApi@Bodytypes retyped to the generated models.Testing
CreatePollRequestAdapterTest,PollOptionInputAdapterTest,PollWriteRequestAdapterTest) lock the flattened wire shape for all 6 models;MoshiChatApiTestcovers the mappers.spotlessApply,apiDump(no public-API change),detekt, and the full clienttestDebugUnitTestsuite pass.createPoll/updatePoll/createPollOption/updatePollOptioneach sendcustomflattened at root andvoting_visibility(bothanonymousandpublic); all return201and echo thecustomsentinel back.Summary by CodeRabbit
Bug Fixes
Tests