Implement Bot API 10.2#94
Closed
ForNeVeR wants to merge 2 commits into
Closed
Conversation
DiscriminatedUnionConverter picked union cases by field-shape overlap,
ignoring the discriminator value Telegram actually uses. Shape matching
cannot be correct for ChatMember: ChatMemberLeft and ChatMemberMember are
shape-identical on the wire, and the first shape-superset won, so
{"status":"member"} parsed as Owner, {"status":"left"} as Owner, and
{"status":"kicked"} as Member. Re-serializing a misdiscriminated value
also invented fields that were never on the wire (is_anonymous).
Fix:
- New Funogram.Types.TelegramTagAttribute(field, value) marks a generated
record as a tag-discriminated union payload (the Bot API documents the
fixed value as `always "X"` on the field).
- The converter captures top-level string property values while shape-
reading and selects the case whose tag matches the JSON value; unions
without tags (and unknown future tag values) fall back to the previous
shape-based resolution, so behavior is strictly corrected, never
narrowed.
- The generator parses `always "X"` from required string field
descriptions and emits the attribute; the checked-in generated Types.fs
is updated accordingly (91 subtypes across ChatMember, MessageOrigin,
ReactionType, PaidMedia, ChatBoostSource, BackgroundType/Fill,
StoryAreaType, OwnedGift, RichText, PageBlock, ...).
Tests: all six ChatMember statuses now parse to the right case (three
failed before), round-trip no longer invents fields, unknown future
statuses still parse (forward compat), and MessageOrigin/ReactionType
keep working.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RrGX1qGPj7jLo1jgotgLKU
ForNeVeR
force-pushed
the
feature/92.bot-api-10.2
branch
from
July 15, 2026 21:33
29acf6f to
b321741
Compare
Owner
|
Bot API was updated in #92 |
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.
Note: this incorporates #93.
Closes #92.