Conversation
Szer
force-pushed
the
feat/strict-parsing
branch
from
September 12, 2026 23:40
8b3e1d0 to
3eab2bc
Compare
…ired fields raise) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EMiBp5SyqwpeiZSYDSn7xZ
Szer
force-pushed
the
feat/strict-parsing
branch
from
September 12, 2026 23:50
3eab2bc to
8fd212a
Compare
Contributor
|
Note that the whole bot infrastructure ( |
Author
that's a backward compatible change, hence old |
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.
DiscriminatedUnionConverter.resolveObjectfalls back to shape-based overlap scoring whenever a discriminator value doesn't match any declared case, andArray.maxBysilently picks the first declared case. Its payload is then deserialized from JSON that's missing the case's real fields, leaving them null even though F# records/DUs are non-nullable by declaration. Real example: Telegram Bot API 10.3 addedRichBlockButtons, butRichBlockhas noButtonscase, so{"type":"buttons","buttons":[{"text":"GET MORE","style":"success","url":"https://example.com"}],"align":"center"}silently deserializes as
RichBlock.ParagraphwithText = null, which NREs downstream. This PR adds an opt-in strict mode that fails loudly instead.[<Always>]discriminator value that matches no case, strict mode raisesJsonExceptioninstead of scoring. Shape-based scoring is untouched and still used for DUs that have no discriminator at all, and non-strict mode is byte-for-byte unchanged.option, reference-typed property of the payload record is non-null, raisingJsonExceptionnaming the missing field and case if not.Funogram.Tools.strictOptions: a newJsonSerializerOptionssitting next to the existingoptions, built from the same converters with the strict flag flipped on. Nested unions inherit it automatically since they resolve converters through the sameJsonSerializerOptions.🤖 Generated with Claude Code
https://claude.ai/code/session_01EMiBp5SyqwpeiZSYDSn7xZ