You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature-Request: Adding rfl::DefaultIfNull to support parsing empty documents or nulled values #796
Dear reflect-cpp team,
during testing I noticed that reflect-cpp can't parse an empty yaml file into the respective struct, even when parsing with rfl::DefaultIfMissing. Some examples, where I would expect it to apply the default values:
Expected: all defaults. This happens whenever someone comments out every setting.
Empty list:
host: example.comtags:
Error: Failed to parse field 'tags': Could not cast to sequence!
Expected: tags empty.
Empty map
host: example.comenv:
Error: Failed to parse field 'env': Could not cast to map!
Expected: env empty.
Section with all children commented out
host: example.comlogging:
# level: debug
Error: Failed to parse field 'logging': Could not cast to map!
Expected: logging with its defaults (level == "info").
Map entry without settings
modules:
network:
storage:
level: debug
Error: Failed to parse field 'modules': Failed to parse field 'network': Could not cast to map!
Expected: modules["network"] is a default Logging
While I totally see that this might not be the desired default-behavior in some cases, it would be a nice feature-flag to have at least for yaml-parsing, but potentially as well for json parsing.
Activity
Add opt-in rfl::DefaultIfNull processor (munich-data-engineering#796)