What
When parsing JSON configuration with score::json, consumers cannot cleanly express the common pattern "use the default if the key is missing, fail fast if the key exists but has the wrong type", because:
GetAttribute<T>(obj, key) does not accept a raw const Object& (only reference_wrapper<const Object> or Result<...>), forcing callers to wrap with std::cref() or fall back to manual find -> second.As<T>().
Result::value_or(default) swallows type errors together with "key not found", so a mistyped field silently falls back to the default instead of producing a clear error.
While implementing the TimeSlave JSON config parser (PR #141) I had to duplicate the same ~10-line helper wrapper. Other components parsing JSON configs will likely hit the same issue.
Acceptance Criteria (DoD)
- An issue is filed against eclipse-score/baselibs describing the gap, referencing this ticket.
- Either the API is extended (e.g. accept
const Object&, or add a helper that distinguishes missing-key from type-error), or the intended usage is documented so downstream projects don't have to reinvent these wrappers.
How
No response
What
When parsing JSON configuration with
score::json, consumers cannot cleanly express the common pattern "use the default if the key is missing, fail fast if the key exists but has the wrong type", because:GetAttribute<T>(obj, key)does not accept a rawconst Object&(onlyreference_wrapper<const Object>orResult<...>), forcing callers to wrap withstd::cref()or fall back to manualfind -> second.As<T>().Result::value_or(default)swallows type errors together with "key not found", so a mistyped field silently falls back to the default instead of producing a clear error.While implementing the TimeSlave JSON config parser (PR #141) I had to duplicate the same ~10-line helper wrapper. Other components parsing JSON configs will likely hit the same issue.
Acceptance Criteria (DoD)
const Object&, or add a helper that distinguishes missing-key from type-error), or the intended usage is documented so downstream projects don't have to reinvent these wrappers.How
No response