added presence api update#1489
Conversation
Greptile SummaryThis PR adds a
Confidence Score: 3/5The presence API implementation has multiple platform-specific gaps where in-flight requests are never settled on connection drop, and a template bug in the Swift model generator produces broken Codable conformance for any schema using a dollar-sign-prefixed additionalPropertiesKey. The Swift model template omits the raw-string value on the new CodingKeys case, meaning any dollar-sign-prefixed x-additional-properties-key generates Swift code that silently reads/writes the wrong JSON field. Across Flutter, Web, and Android realtime templates, the onDone/onError/close/disconnect paths do not drain pendingPresenceRequests, so any createPresence call in flight when the connection drops will hang indefinitely. templates/swift/Sources/Models/Model.swift.twig (CodingKeys raw value), templates/flutter/lib/src/realtime_mixin.dart.twig, templates/web/src/services/realtime.ts.twig, and templates/android/library/src/main/java/io/package/services/Realtime.kt.twig (connection-close drain gaps) Important Files Changed
Reviews (4): Last reviewed commit: "updated mock server" | Re-trigger Greptile |
|
|
||
| return completer.future; | ||
| } | ||
| } No newline at end of file |
| {%~ endfor %} | ||
| {%~ if definition.additionalProperties %} | ||
| case data | ||
| case {{ definition.additionalPropertiesKey | default('data') | escapeSwiftKeyword | removeDollarSign }} |
There was a problem hiding this comment.
The
CodingKeys enum case for additionalPropertiesKey is missing its explicit raw-string value. All regular properties use case <identifier> = "<json-key>" so that the Swift identifier (after removeDollarSign) stays bound to the correct JSON key even when the names diverge. The new additionalProperties case omits the = "..." part, so Swift falls back to using the identifier name as the key. If additionalPropertiesKey is anything that requires escaping (e.g., a $-prefixed key like $presence), removeDollarSign strips the $ and the generated Codable conformance will silently read/write the wrong JSON field.
| case {{ definition.additionalPropertiesKey | default('data') | escapeSwiftKeyword | removeDollarSign }} | |
| case {{ definition.additionalPropertiesKey | default('data') | escapeSwiftKeyword | removeDollarSign }} = "{{ definition.additionalPropertiesKey | default('data') }}" |
What does this PR do?
(Provide a description of what this PR does.)
Test Plan
(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)
Related PRs and Issues
(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)
Have you read the Contributing Guidelines on issues?
(Write your answer here.)