Repository navigation
Support nested and flattened rfl::TaggedUnion - #82
Open
clockblocker wants to merge 6 commits into
Open
clockblocker wants to merge 6 commits into
clockblocker wants to merge 6 commits into
Conversation
This was referenced Nov 27, 2026
clockblocker
force-pushed
the
nested-tagged-union
branch
from
November 27, 2026 13:37
c71ee62 to
6bcb482
Compare
3 of 16 tasks
…Val decoupling, ReflectionType/Reflector support, make_tag precedence, and compile-time guards
…t, and multi-TU post-leaf cleanup
clockblocker
force-pushed
the
field-alias
branch
from
November 27, 2026 21:29
0c4c630 to
7df687d
Compare
clockblocker
force-pushed
the
nested-tagged-union
branch
from
November 27, 2026 21:37
67c4db1 to
9830d48
Compare
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.
Summary
Supports multi-level / nested
rfl::TaggedUniondispatch directly (e.g.,rfl::TaggedUnion<"type", A, NestedUnion>andrfl::Flatten<rfl::TaggedUnion<...>>), eliminating the real-world need to parse raw JSON twice and duplicate dummy outer discriminator fields on every inner variant struct (observed inhudson-trading/slang-serverWCP events andobs-websocketRPC dispatch).What Changed
rfl::TaggedUnionalternatives:rfl::TaggedUnion<"outer", DirectAlt, InnerTaggedUnion>andrfl::Flatten<rfl::TaggedUnion<...>>now work across single-pass read, write,NoExtraFields, andto_schema.FlattenedTaggedUnionParser.hpp): Dispatches cleanly without double-parsing raw input strings; detects conflicting/duplicate discriminators and duplicate fields at compile time.is_tagged_union.hpp,has_flattened_tagged_union.hpp): Detects direct and flattenedTaggedUnionmembers across C++20 and C++26 field-name reflection paths.docs/content/variants_and_tagged_unions.mdanddocs/content/flatten_structs.md.tests/json/test_nested_tagged_union.cpp,tests/generic/test_nested_tagged_union.cpp, and 2 compile-fail tests (nested_tu_duplicate_discriminator.cpp,nested_tu_duplicate_field.cpp).Verification
-Wall -Werror: 608/608 tests passed (100%).