Report both length and item-type errors for sequence values
Follow-up from the review of #4090 (fix for #3752).
Problem
import altair as alt
alt.selection_interval(
resolve="global",
value={"x": ["Europe"], "y": [10, 20]},
)value.x has two genuine complaints: the list is too short (minItems), and its only item has the wrong type. Altair's error pipeline keeps only the most specific JSON path, so one complaint is always hidden. #4090 makes the length error win over the nested item error:
'['Europe']' is an invalid value for `x`. Valid values are of type `Sequence` with at least 2 items.That is more useful than before, but the item-type complaint is still dropped.
Context
_subset_to_most_specific_json_paths documents the assumption that "more specific json paths give more helpful error messages to the user". Sequence-length errors are the counterexample: $.x (too short) is less specific than $.x[0] (wrong item type), yet often more actionable.
Suggested direction
For sequence values that violate both length and item constraints, surface both complaints — e.g. report that the sequence needs at least 2 items and that 'Europe' is not a valid item type. Consider whether the most-specific-path rule should be length-aware generally instead of special-casing minItems/maxItems.
Source: vega/altair