@JafetRomanU@benhylak This is why I personally always use languages which give me typed JSON models with validation upon deserialization. I never want to find myself needing to think if the users input is right or not. Deserialize, log if needed, propagate the error to the user if needed.
@JafetRomanU@benhylak I disagree very strongly here, something like this must be an error. If it’s not then values like this will just travel deeper and deeper into the call stack until one day you truly get an error which takes weeks to debug.
@JafetRomanU@benhylak It’s not about the false sense of security as much as it’s about it being better to catch this here before it goes deeper into the call stack and all of a sudden you get a “can’t add string to number” error or some kind of hard to debug error
@JafetRomanU@benhylak Situations like this aren’t just “what if”s. If you lose the types at some point in the code due to some kind of contamination or alteration then you’re forced to do runtime checks. If this isn’t ideal use a language with static typing for JSON.
@imblitzkrieg@benhylak Sure, I agree that array iteration should be the last checks that run. Also depends on what the realistic size of those arrays are. I see “prompts” in there so I have to assume they’re building some kind of harness. Even if those arrays have 10,000 elements that’s not negligible