feat(votes): typed Vote model for AsobiVotes#20
Merged
Merged
Conversation
Extracts the only still-unique content from the stale #15 branch: a typed Vote/VoteListResponse model so AsobiVotes.GetAsync/ListForMatchAsync return parsed objects instead of raw JSON strings. Scalar fields deserialize via JsonUtility; the jsonb fields (options/votes_cast/result/distribution) arrive as arrays/objects and are captured as raw JSON via ExtractJsonField, matching the established ParseMatchRecord convention. #15's other changes are dropped as already-landed: auth (#19), the dispatcher/test infra (#13), .editorconfig (#17).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Untangles #15. That branch predated #13/#17/#19 and had ~60 conflicting files; this extracts the only content still unique to it — the typed Vote model — onto a clean branch off main.
What this adds
Runtime/Models/VoteModels.cs—Vote+VoteListResponse.AsobiVotes.GetAsync/ListForMatchAsyncnow returnVote/VoteListResponseinstead of raw JSON strings.JsonHelper.ParseVote/ParseVoteList.Correctness
Verified the model against the backend schema (
asobi_vote.erl): scalar fields (id, match_id, template, method, turnout, eligible_count, window_ms, timestamps) deserialize viaJsonUtility; the four jsonb fields (optionsarray,votes_cast/result/distributionobjects) are captured as raw JSON viaExtractJsonField, matching the establishedParseMatchRecordconvention.Http.GetRawconfirmed present on main post-#19.What was dropped from #15 (already landed elsewhere)
AsobiAuth/HttpClient/AuthModels) — superseded by feat: sync auth to access/refresh token pair #19; lifting it would revert feat: sync auth to access/refresh token pair #19..editorconfig— landed in chore: add .editorconfig for C# style and analyzer conventions #17.Tests
No license-free unit test:
JsonHelperdepends onUnityEngine.JsonUtility, so it isn't compiled by the.NETdispatch project (which builds onlyAsobiDispatcher). Like every otherParse*method, the vote path is exercised by the PlayMode suite onceUNITY_LICENSEis set.Closes #15.