[PR #6890] Update JsonNew for IReference+cleaner optionals, and better Mappers #26800

Open
opened 2026-01-31 09:18:14 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/6890

State: closed
Merged: Yes


This commit updates JsonUtilsNew to support winrt
Windows::Foundation::IReference<T> as an option type, and cleans up the
optional support code by removing the optional overload on
GetValue(...). Instead of using an overload with a partial
specialization, we're using a constexpr if with a type trait to
determine option-type-ness.

In addition, Carlos reported an issue with deriving from FlagMapper
(itself templated) and referring to the base type's members without
fully qualifying them. To make derivation easier, EnumMapper and
FlagMapper now provide BaseEnumMapper and BaseFlagMapper type
aliases.

I've taken the opportunity to add a winrt::hstring conversion
trait.

Lastly, in casual use, I found out that I'd written the til::color
converter wrong: it supports color strings of length 7 (#rrggbb) and
length 4 (#rgb). I mistyped (and failed to test) support for 4-length
color strings by pretending they were only 3 characters long.

References

Merged JsonUtils changes from #6004 and #6590.

PR Checklist

  • Unblocks aforementioned PRs
  • cla
  • Tests added/passed
  • Documentation N/A
  • Schema N/A
  • Kid tested, mother approved.
**Original Pull Request:** https://github.com/microsoft/terminal/pull/6890 **State:** closed **Merged:** Yes --- This commit updates JsonUtilsNew to support winrt `Windows::Foundation::IReference<T>` as an option type, and cleans up the optional support code by removing the optional overload on `GetValue(...)`. Instead of using an overload with a partial specialization, we're using a constexpr if with a type trait to determine option-type-ness. In addition, Carlos reported an issue with deriving from `FlagMapper` (itself templated) and referring to the base type's members without fully qualifying them. To make derivation easier, `EnumMapper` and `FlagMapper` now provide `BaseEnumMapper` and `BaseFlagMapper` type aliases. I've taken the opportunity to add a `winrt::hstring` conversion trait. Lastly, in casual use, I found out that I'd written the til::color converter wrong: it supports color strings of length 7 (`#rrggbb`) and length 4 (`#rgb`). I mistyped (and failed to test) support for 4-length color strings by pretending they were only 3 characters long. ## References Merged JsonUtils changes from #6004 and #6590. ## PR Checklist * [x] Unblocks aforementioned PRs * [x] cla * [x] Tests added/passed * [x] Documentation N/A * [x] Schema N/A * [x] Kid tested, mother approved.
claunia added the pull-request label 2026-01-31 09:18:14 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#26800