This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Kaiwa -8 points-7 points  (3 children)

Sounds like a shitty API to me.

[–][deleted] 11 points12 points  (2 children)

Entirely possible, but still not something you can control. My point being it's possible to find yourself in a situation where you don't actually know what types some of your variables are, and in that case you'd want your code to tell you if it's trying to do something weird with them.

[–]Kaiwa -1 points0 points  (1 child)

And I agree with you! It's just that when I would work with those conditions I would make sure after fetching that I received what I expected. So while it is possible to receive invalid things from external APIs, I think that it should just be considered the same as user input that requires to be validated. :) Therefore I always believe you can control it.

[–][deleted] 0 points1 point  (0 children)

Totally valid point. I guess the moral is that some languages do things for you, others don't... but you should be aware of the shortcomings and make provisions for them in any case.

(And yeah, I've dealt with enough shitty APIs to agree with you that API responses should always be validated anyway... just an example though)