Yeah, YAML deserialization is the worst case scenario for dynamic typing. In most situations, types are pretty consistent and assuming you run your code at least once, you'll find most errors. But with YAML deserialization all bets are off. YAML is even worse then JSON for this because seemingly minor changes in the YAML can change the shape of the data.
I've had success validating such data against a schema, so I know it had consistent type structure before working with it.
I've had success validating such data against a schema, so I know it had consistent type structure before working with it.