Repository navigation
Read structs with defaults that hold a Validator without a valid default - #38
Draft
clockblocker wants to merge 1 commit into
Draft
clockblocker wants to merge 1 commit into
clockblocker wants to merge 1 commit into
Conversation
clockblocker
force-pushed
the
fix-700-deferred-defaults-next
branch
from
November 17, 2026 08:30
57cb03d to
ac217e3
Compare
clockblocker
force-pushed
the
default-val-fixes
branch
from
November 17, 2026 08:54
7611ee1 to
ae8b6a7
Compare
clockblocker
force-pushed
the
fix-700-deferred-defaults-next
branch
2 times, most recently
from
November 17, 2026 18:57
288f83a to
9afb290
Compare
Co-Authored-By: Claude Opus 5.5 <[email protected]>
clockblocker
force-pushed
the
fix-700-deferred-defaults-next
branch
from
November 21, 2026 08:49
9afb290 to
fc8e765
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
Fixes munich-data-engineering/reflect-cpp#700 (next iteration of munich-data-engineering#780): allows reading and generating JSON Schema for structs that mix
rfl::DefaultVal/rfl::DefaultIfMissingwithrfl::Validatorfields whose default value is invalid, while keepingrfl::Validatortrivially copyable.Example
How it works
T{}throws duringread_struct_with_default, the parser retriesT{}inside a thread-local deferral scope whereValidator()keeps its invalid default and increments a counter instead of throwing.Tto confirm it holds at least as many invalidValidators as were deferred; after reading, it walks every missing field's default and fails if any invalidValidatoror uncheckable opaque type remains.Validatorkeeps defaulted copy/move constructors (stays trivially copyable; zero copy-path overhead).Known limits
Validator(e.g.int b = a.value() * 2;) observes its invalid value.Validator(e.g.int port = Positive().value();) fails the read unless another invalidValidatorcopy offsets the count.Validatorinside an opaque class the walker cannot inspect fails the read (as onmain), and a missing field of such an opaque type also fails when deferral is active.try/catchfallback inside a member initializer receives no exception while deferral is active, so that field must be supplied in the input.AI-authored. Base:
main(after munich-data-engineering#786).