Repository navigation
Add opt-in rfl::DefaultIfNull processor (#796) - #79
Open
clockblocker wants to merge 5 commits into
Open
clockblocker wants to merge 5 commits into
clockblocker wants to merge 5 commits into
Conversation
This was referenced Nov 27, 2026
…eset omitted nullable DMIs, preserve nullable variants
clockblocker
force-pushed
the
default-if-null
branch
from
November 27, 2026 21:05
4d786e2 to
642cd8c
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
Adds an opt-in, format-general
rfl::DefaultIfNullprocessor that treats null/empty input values (_r.is_empty(_var)) as default-constructed values across YAML, JSON, Generic, and other readers, while leaving default behavior withoutDefaultIfNullcompletely unchanged.Addresses munich-data-engineering#796
Details
include/rfl/DefaultIfNull.hppandinclude/rfl/internal/default_if_null_v.hpp(wired intoinclude/rfl.hpp).#796: empty document, all-commented YAML document, null sequence (tags:), null map (env:), null nested struct (logging:) preserving DMIs, and null map/container element (modules:\n network:).int port = 8080;stays8080onport: null), keeps missing required fields failing unlessrfl::DefaultIfMissingis also passed, and keeps nullable types (std::optional,std::unique_ptr,std::shared_ptr, raw pointers,rfl::Generic) decoding explicitnullas empty even when they have non-null DMIs.tests/yaml/test_default_if_null.cpp,tests/json/test_default_if_null.cpp) and documented indocs/content/processors.md.Verification
ctest -R "(yaml\.|default|null|optional)": 134/134 PASSED.ctestsuite (json,yaml,generic,cli,env,json_c_arrays_and_inheritance) under-Wall -Werror: 666/666 PASSED.