best way to make conditional arrays in json schema with decent error messages
问题 I would like to constrain a (tuple) array in JSON-schema, and get decent error messages but so far I was unsuccessful. The array consists of 2 items, the first is a string, and the second is an object. The properties that are allowed/required in the object depends on the string. 2 valid examples would be: { "color": [ "white", { "a white property": 42 }] } and { "color": [ "black", { "this is a black property": "tAttUQoLtUaE" }] } for reference, the type in typescript would be defined as: