Description
As currently specified, we require at least one variant of each .match
message to have only *
keys. Otherwise, we consider the message to have a Missing Fallback Variant data model error.
This requirement ensures that no matter the case, selection on a valid message will always produce some explicitly defined pattern.
It is however possible to define selectors such as :plural
or :boolean
for which the presence of some set of keys guarantees that selection will succeed, such as ['other']
for the former and ['true', 'false']
for the latter.
If we were to make the current error a runtime Selection Error like "No Variant Selected" instead of a Data Model Error, it would allow for more natural messages, such as:
.match {$exists :boolean}
true {{You have the thing.}}
false {{You don't have it.}}
instead of our current
.match {$exists :boolean}
true {{You have the thing.}}
* {{You don't have it.}}
With access to a registry definition, it would still be possible to validate messages for completeness.
An outline of the changes required for this are available in #560 (comment).
I'm assigning this to @stasm, as he mentioned this topic near the end of today's call, and I just wanted to be sure we had an issue filed on this. Please feel free to take over here.